N
N
Natalia2020-08-09 13:25:54
Python
Natalia, 2020-08-09 13:25:54

Pycharm does not run the pyTelegramBotAPI library, is it written that there is no connection with the service?

A newbie in the world of Python..
I wrote the code for the telegram bot. I run it in pycharm, it says that there is no connection to the server. Pycharm has pip installed, the yTelegramBotAPI library.

Error :
2020-08-09 13:07:59,135 (util.py:68 PollingThread) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body :\n[b\'{"ok":false,"error_code":409,"description":"Conflict: can\\\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"} \']',)
Traceback (most recent call last):
File "D:\Soft\python\lib\site-packages\telebot\util.py", line 62, in run
task(*args, **kwargs)
File "D:\Soft\python\lib\site-packages\telebot\__init__.py", line 285, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "D :\Soft\python\lib\site-packages\telebot\__init__.py", line 255, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "D:\Soft\python \lib\site-packages\telebot\apihelper.py", line 206, in get_updates
return _make_request(token, method_url, params=payload)
File "D:\Soft\python\lib\site-packages\telebot\apihelper.py ", line 69, in _make_request
return _check_result(method_name, result)['result']
File "D:\Soft\python\lib\site-packages\telebot\apihelper.py", line 88, in _check_result
raise ApiException(msg, method_name, result)
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful . The server returned HTTP 409 Conflict. Response body:
[b'{"ok":false,"error_code":409,"description":"Conflict: can\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}']
"
2020-08-09 13:07:59,136 (__init__.py:455 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. response body:
[b'{"ok":false,"error_code":409,"description":"Conflict: can\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}']"
2020-08 -09 13:08:02,529 (util.py:68 PollingThread) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:\n[b \'{"ok":false,"error_code":409,"description":"Conflict: can\\\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}\']', )
Traceback (most recent call last):
File "D:\Soft\python\lib\site-packages\telebot\util.py", line 62, in run
task(*args,**kwargs)
File "D:\Soft\python\lib\site-packages\telebot\__init__.py", line 285, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "D:\Soft\python\lib\site-packages\telebot\__init__.py", line 255, in get_updates
json_updates = apihelper .get_updates(self.token, offset, limit, timeout, allowed_updates)
File "D:\Soft\python\lib\site-packages\telebot\apihelper.py", line 206, in get_updates
return _make_request(token, method_url, params =payload)
File "D:\Soft\python\lib\site-packages\telebot\apihelper.py", line 69, in _make_request
return _check_result(method_name, result)['result']
2020-08-09 13:08 :02,530 (__init__.py:455 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:
[b'{"ok":false,"error_code":409,"description":"Conflict: can\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}']"
2020-08 -09 13:08:03,140 (util.py:68 PollingThread) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:\n[b \'{"ok":false,"error_code":409,"description":"Conflict: can\\\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}\']', )
Traceback (most recent call last):
File "D:\Soft\python\lib\site-packages\telebot\util.py", line 62, in run
task(*args,**kwargs)
File "D:\Soft\python\lib\site-packages\telebot\__init__.py", line 285, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "D:\Soft\python\lib\site-packages\telebot\__init__.py", line 255, in get_updates
json_updates = apihelper .get_updates(self.token, offset, limit, timeout, allowed_updates)
File "D:\Soft\python\lib\site-packages\telebot\apihelper.py", line 206, in get_updates
return _make_request(token, method_url, params =payload)
File "D:\Soft\python\lib\site-packages\telebot\apihelper.py", line 69, in _make_request
return _check_result(method_name, result)['result']
File "D:\Soft\python \lib\site-packages\telebot\apihelper.py", line 88, in _check_result
raise ApiException(msg, method_name, result)
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:
[b'{"ok":false,"error_code":409,"description":"Conflict: can\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}']
2020 -08-09 13:08:09,413 (__init__.py:455 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:
[b'{"ok":false ,"error_code":409,"description":"Conflict: can\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}']"
2020-08-09 13:08:13,531 (util.py:68 PollingThread) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:\ n[b\'{"ok":false,"error_code":409,"description":"Conflict: can\\\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}\' ]',)
Traceback (most recent call last):
File "D:\Soft\python\lib\site-packages\telebot\util.py", line 62, in run
task(*args, **kwargs)
File " D:\Soft\python\lib\site-packages\telebot\__init__.py", line 285, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "D:\Soft\python\lib\site-packages\telebot\__init__.py", line 255, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "D:\ Soft\python\lib\site-packages\telebot\apihelper.py", line 206, in get_updates
return _make_request(token, method_url, params=payload)
File "D:\Soft\python\lib\site-packages\telebot\ apihelper.py", line 69, in _make_request
return _check_result(method_name, result)['result']
File "D:\Soft\python\lib\site-packages\telebot\apihelper.py", line 88, in _check_result
raise ApiException(msg, method_name, result)
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:
[b'{"ok":false,"error_code":409,"description":"Conflict: can\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}']
"
2020-08-09 13:16:38,243 (__init__.py:455 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:
[b'{"ok":false,"error_code":409,"description":"Conflict: can\'t use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"}']"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2020-08-09
Kolins @snackli17

Use the deleteWebhook method to delete the old webhook
https://api.telegram.org/bot<token>/deleteWebhook

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question