Aggiornamento URL scraping e compatibilità Python 3.13 - #10
Open
gorlix wants to merge 46 commits into
Open
Conversation
Ensures the error handler doesn't fail if the developer chat ID is not configured. Prevents sending error messages if the ID is absent, avoiding potential exceptions.
Updates the python-telegram-bot dependency to the latest version. Adds the standard-imghdr dependency. This library likely enhances image handling capabilities within the project.
- Added Dockerfile for containerized deployment (python:3.9-slim). - Created GitHub Action workflow to publish image to GHCR on 'new_relese'. - Updated language files (en.json, it.json) with new maintainer info and repo links. - Replaced original author references with Gorlix/Alessandro Gorla (fork attribution).
…lese] - Added Dockerfile (python:3.9-slim) with curl support. - Added docker-compose.yml with host networking, volume mapping, and heartbeat healthcheck. - Implemented heartbeat mechanism in bot.py to monitor process health. - Configured data persistence with local 'data/' directory. - Created GitHub Action workflow to build and push to GHCR on 'new_relese'. - Updated language files with new maintainer info (Alessandro Gorla/Gorlix) and repo links.
- Caching: Implemented 30-minute in-memory cache for find_classrooms to reduce network requests and improve speed for repeated searches. - UX: Added "Caricamento in corso..." (Loading) message during search. - Opening Hours: Added json/opening_hours.json with granular schedules and updated filtering logic to respect specific building closures. - Error Handling: Fixed crash when server returns 502/empty results (now shows "No rooms found"). - Logs: Silenced verbose apscheduler logs and simplified Heartbeat logging. - Performance: Added logging for network request duration.
feat: add caching, granular opening hours, and improved error handling
feat: add caching, granular opening hours, and improved error handling
- **Texts**: Replaced rude/plain error messages with polite alternatives (e.g., "Use button" instead of swearing). - **UX**: added appropriate emojis to all messages (welcome, info, errors) to make the bot friendlier. - **Fixes**: Fixed small typos in Italian translation.
- Rewrote README.md for clarity and professionalism. - Added badges for Python, Docker, License, and Telegram Bot link. - Added "Get Started" section with direct bot link. - Separated "Deployment" into Docker (recommended) and Manual sections. - Documented "Opening Hours" configuration. - Removed excessive emojis from headers for a cleaner look.
- **Support Nested JSON**: Updated bot logic to handle new [location.json] structure with "sedi" and codes. - **Fix Crashes**: - Handled missing `tableContainer` in parser (prevents `AttributeError`). - Handled empty search results correctly (prevents `Message text is empty` error). - Fixed regex filter to allow "❌Back" emoji button to work in all states. - **UI Improvements**: - Show full Campus/Location name in search results header instead of codes. - Formatted header with emojis and bold text. - Added support for "All Buildings" (Tutti gli edifici) search via updated keyboards.
**New Feature: Emoji Mode** - Added a new "Format" toggle in Settings (Text vs Emoji). - Created [functions/formatter.py](cci:7://file:///home/gorlix/Documents/Git/AuleLiberePoliMi/functions/formatter.py:0:0-0:0) to handle message formatting and time conversion (e.g., 15.5 -> 15:30). - Updated [string_builder.py](cci:7://file:///home/gorlix/Documents/Git/AuleLiberePoliMi/functions/string_builder.py:0:0-0:0) to support the new format mode. - Implemented visual alignment in Emoji Mode using ideographic spaces for rooms without plugs. - Added persistent user preference for [format_mode](cci:1://file:///home/gorlix/Documents/Git/AuleLiberePoliMi/functions/user_data_handler.py:76:0-83:21). - Updated IT/EN language files with new texts and button labels. **Logging & Performance** - Added `requests-cache` to cache PoliMi API responses (1 hour duration). - Added logging for server response time and Cache HIT/MISS status. - Simplified heartbeat logging in [bot.py](cci:7://file:///home/gorlix/Documents/Git/AuleLiberePoliMi/bot.py:0:0-0:0) to reduce log noise. **Bug Fixes** - Fixed [now()](cci:1://file:///home/gorlix/Documents/Git/AuleLiberePoliMi/bot.py:110:0-140:37) (ORA) command failure by correctly mapping Campus Names to their internal API Codes. - Fixed `NameError` crash in `bot.py` by reordering function definitions.
feat: Add Emoji Mode, Improve Logging & Fix Bugs
- Rewrites all docstrings and comments in bot.py, functions/, and search/ to professional English using Google Style Docstrings.
- Updates README.md to include:
- New features: Power Plugs and Customizable Interface.
- Development section outlining code standards.
- Updated cache TTL to 1 hour.
Users can now type @polimiAuleLibereBot in any chat to trigger an inline search using their saved campus and duration preferences. Returns a no-preferences notice if campus is not configured yet. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tool - Track unique users in data/users.json (user_id, username, first/last seen, action count) on /start and inline queries for campaign analysis - Refactor inline results to one article per building instead of per message page, giving users cleaner choice of what to share - Add broadcast.py: one-shot script to message all historical users (reads from PicklePersistence + users.json) for update announcements Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Inline mode: @polimiAuleLibereBot in any chat shows free classrooms now using saved preferences; one result per building - User analytics: data/users.json tracks unique users (first_seen, last_seen, actions) for campaign analysis - broadcast.py: one-shot script to notify all historical users Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bumps the pip group with 2 updates in the / directory: [certifi](https://github.com/certifi/python-certifi) and [idna](https://github.com/kjd/idna). Updates `certifi` from 2021.10.8 to 2024.7.4 - [Commits](certifi/python-certifi@2021.10.08...2024.07.04) Updates `idna` from 3.3 to 3.15 - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md) - [Commits](kjd/idna@v3.3...v3.15) --- updated-dependencies: - dependency-name: certifi dependency-version: 2024.7.4 dependency-type: indirect dependency-group: pip - dependency-name: idna dependency-version: '3.15' dependency-type: indirect dependency-group: pip ... Signed-off-by: dependabot[bot] <support@github.com>
Bump the pip group across 1 directory with 2 updates
Python 3.9 reached end-of-life (2025-10) and its version cap held urllib3, requests, python-dotenv and black below their patched releases (all require Python >=3.10). Bumping the runtime to 3.10 moves off EOL and unlocks the security fixes applied in the following commit. - Pipfile: requires python_version 3.10 - Dockerfile: python:3.9-slim -> python:3.10-slim
Regenerate Pipfile.lock and pin secure minimums in requirements.txt (the file the Docker image actually installs from) to the patched releases. python-telegram-bot==13.15 hard-pins tornado==6.1, which is kept to avoid breaking the library; its CVEs are webhook-only and unreachable in this bot (polling mode, Updater.start_polling). Resolves Dependabot alerts: - requests 2.26.0 -> 2.34.2 (alerts 25, 17, 10, 2) - urllib3 1.26.7 -> 2.7.0 (alerts 28, 21, 20, 19, 18, 13, 7, 6) - python-dotenv 0.19.1 -> 1.2.2 (alert 27) - black 21.9b0 -> 26.5.1 (dev) (alerts 24, 8) Deferred (tornado==6.1 pinned by python-telegram-bot 13.15, not reachable in polling mode): alerts 26, 23, 22, 16, 14, 12, 11, 4, 3
fix(deps): resolve Dependabot security alerts (bump deps + Python 3.10)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
.env.now(conversione esplicita a stringa).Test: Il bot è stato testato localmente e ora riesce a scaricare correttamente i dati delle aule e a rispondere ai comandi senza errori.