telegramratelimitmessage = f"{numrequests} request rate triggered rate limit on…
- User
telegramratelimitmessage = f"{num_requests} request rate triggered rate limit on {processID}! Sleeping for 120s." telegramratelimitpayload = { 'chat_id': chat_id, 'text': telegramratelimitpayload } requests.post(telegram_url, data=telegramratelimitpayload)
This snippet of code causes my program to crash, why?
- Assistant
There seems to be a typo in the code. In the line
telegramratelimitpayload = { 'chat_id': chat_id, 'text': telegramratelimitpayload}, you are trying to assign thetelegramratelimitpayloadvariable (which is a string) to thetextkey in the dictionary. This assignment should actually be pointing totelegramratelimitmessage, which is the intended message to be sent.You should update the assignment line to
telegramratelimitpayload = { 'chat_id': chat_id, 'text': telegramratelimitmessage}. This should fix the issue and prevent the program from crashing.