Error while parsing JSON?

0 like 0 dislike
105 views
Use WebHook in your TelegramBot'e
It is so to speak form (name and phone number)

So when filling in the `name` comes out error :

2019-02-01 13:06:42,362: Exception on /`secret` [POST] Traceback (most recent call last): File "/home/PyRayman/venv/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/home/PyRayman/venv/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/PyRayman/venv/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/PyRayman/venv/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/home/PyRayman/venv/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/home/PyRayman/venv/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/PyRayman/TelegramBot/mainbot.py", line 85, in webhook bot.process_new_updates([update]) File "/home/PyRayman/venv/lib/python3.6/site-packages/telebot/__init__.py", line 314, in process_new_updates self.process_new_messages(new_messages) File "/home/PyRayman/venv/lib/python3.6/site-packages/telebot/__init__.py", line 333, in process_new_messages self._notify_next_handlers(new_messages) File "/home/PyRayman/venv/lib/python3.6/site-packages/telebot/__init__.py", line 1299, in _notify_next_handlers self._exec_task(handler["callback"], message, *handler["args"], **handler["kwargs"]) File "/home/PyRayman/venv/lib/python3.6/site-packages/telebot/__init__.py", line 464, in _exec_task task(*args, **kwargs) TypeError: 'str' object is not callable


that's actually part of the code where the error is displayed:
@app.route('/{}'.format(secret),methods=['POST']) def webhook(): print(flask.request.headers) if flask.request.headers.get('content-type') == 'application/json': json_string = flask.request.get_data().decode('utf-8') update = telebot.types.Update.de_json(json_string) bot.process_new_updates([update]) return" else: print('You NOT made it!') flask.abort(403)
by | 105 views

3 Answers

0 like 0 dislike
Most likely, you named the attribute class(skoee all task), as well as a method.
by
0 like 0 dislike
Exception on /`secret` [POST]
There is no error in the url?
by
0 like 0 dislike
Judging by the place where there's an error you have in liseners line(s) and must be method(s)
def handle_messages(messages):
for message in messages:
# Do something with the message
bot.reply_to(message, 'Hi')

bot.set_update_listener(handle_messages)
by

Related questions

0 like 0 dislike
3 answers
asked Sep 4, 2019 by RaymanPy
0 like 0 dislike
3 answers
asked Aug 9, 2019 by RaymanPy
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users