You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Greeting, thank you for your wonderful work! Currently, I'm writing a telegram bot using flask and webhook for my company.
I found your bot and it's easy to understand. However, when I try to run and test the POST method (with Postman), I received:
* Serving Flask app 'app' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2021-12-27 23:07:30,019] ERROR in app: Exception on /<bot-token-not-shown> [POST]
Traceback (most recent call last):
File "D:\Anaconda3\envs\XXXXX\lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "D:\Anaconda3\envs\XXXXX\lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\Anaconda3\envs\XXXXX\lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "D:\Anaconda3\envs\XXXXX\lib\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "G:\XXXXX\flask-telegram-bot\app.py", line 17, in respond
update = telegram.Update.de_json(request.get_json(force=True), bot)
File "D:\Anaconda3\envs\XXXXX\lib\site-packages\telegram\update.py", line 416, in de_json
return cls(**data)
TypeError: __init__() missing 1 required positional argument: 'update_id'
I'm using Python 3.8 and python-telegram-bot 13.9
The text was updated successfully, but these errors were encountered:
I've even tried to create a new Anaconda environment with Python 3.6 and done pip install -r requirements.txt but it seems that the problem still happens:
File "/home/ubuntu/anaconda3/envs/XXXXX/lib/python3.6/site-packages/telegram/update.py", line 219, in de_json
return cls(**data)
TypeError: __init__() missing 1 required positional argument: 'update_id'
p/s: I tried to run on both OSes: Windows 11 (my PC at home) and Linux (the company PC)
Not sure how to fix this bug. However, I've found that: when I tried to call /getUpdates from the api.telegram.org, it said:
{"ok":false,"error_code":409,"description":"Conflict: can't use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}
Therefore, I understood my problem - missing the 'update_id' (since the telegram bot couldn't retrieve the getUpdates info successfully). I think the webhook shouldn't be actived before the getUpdates method is called. How can I fix this?
Greeting, thank you for your wonderful work! Currently, I'm writing a telegram bot using flask and webhook for my company.
I found your bot and it's easy to understand. However, when I try to run and test the POST method (with Postman), I received:
I'm using Python 3.8 and python-telegram-bot 13.9
The text was updated successfully, but these errors were encountered: