/vcv_updater

Script to automatically send me daily updates from Vancouver via Telegram bot

Primary LanguagePython

vancouver_updater

This is a Python script that gets current information about Vancouver and sends it to a telegram chat

It works by:

  • Getting the current temperature and humidity for Vancouver location using a google search

    • requests library is used to send a GET to the webpage API endpoint for Vancouver
    • temperature and humidity values are directly returned using the API
  • Getting the current exchange rate from CAD to BRL using a google search

  • Connecting to a Telegram bot that sends the updated information to an user:

    • the telegram API is accessed using the bot api token to establish connection to the bot
    • the bot can then send message to a chat with the user, using the specific chat ID

Telegram tasks are run asynchronously to ensure they have enough time to complete without errors and prevent errors due to flood control. These are run with a short time interval between them.

It used to be based on APIs for weather and exchange rates information but free usage limits were too restricted.

The original idea was to keep it running in a Docker container but that turned out to be too much of a hassle since it would require finding Docker-specific ways to ensure docker time was local time and that logs generated by the script were properly saved to a persistent storage.
Currently, it's being run by a Ubuntu VM, with its execution scheduled via crontab.