Take the token out of the tracked file, and put a timeout on the two API calls #10
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
azer/randcatbot-py!10
Loading…
Reference in a new issue
No description provided.
Delete branch "azer/token-from-env-and-timeouts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
config.py held the bot token as a literal, so running this starts with editing a file git is watching, and one 'git commit -a' later it is in the history of a public repository for good. It now comes from BOT_TOKEN, main refuses to start without one instead of handing Telegram an empty string, and a .gitignore is added (there was none). The two requests.get calls are blocking and are made from inside coroutines, so an API that stops answering does not slow one reply down - it stops the bot answering anybody; both now carry a 10s timeout. Checked by calling both Animals methods against the live APIs: URLs and captions come back as before. Separately, and not touched here: requirements.txt pins aiohttp 3.7.4, requests 2.23.0, idna 2.9 and Babel 2.9.1, all of which carry published advisories - moving them means moving aiogram off 2.7, which is a change worth making deliberately.