yurnov / exchange-rate-telegram-bot

A simple bot that sends the current exchange rate of the USD, EUR, and PLN to UAH from Monobank API to a Telegram chat
MIT License
1 stars 0 forks source link

Multi user/frequent request cause {"errorDescription":"Too many requests"} in API respnse #2

Closed yurnov closed 7 months ago

yurnov commented 7 months ago

Monobank API has a limit of API request frequency and current implementation where each /rate request in the bot cause a single/individual request to the bot and the of requests can be easily reached.

It causes multiple error messages like:

2024-02-07 23:02:39,656 - __main__ - ERROR - Error parsing exchange rates from Monobank API response
2024-02-07 23:02:42,213 - __main__ - ERROR - Error parsing exchange rates from Monobank API response
2024-02-08 07:29:10,390 - __main__ - ERROR - Error parsing exchange rates from Monobank API response

It can be avoided by performing API calls with some intervals between requests and use rates gathered in the last request when answering to the telegram user.

yurnov commented 7 months ago

Closing with version v0.2.0