Pycharm не запускает библиотеку pyTelegramBotAPI, написано что нет связи с сервисом?

Новичок в мире Питона..
Написала код для телеграмм бота. Запускаю в pycharm , написано что нет соединение с сервесом. На pycharm установлен pip, библиотека yTelegramBotAPI.

Ошибка :
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"}']"
  • Вопрос задан
  • 563 просмотра
Решения вопроса 1
deepblack
@deepblack Куратор тега Python
Используй метод deleteWebhook, чтобы удалить старый вебхук

https://api.telegram.org/bot<token>/deleteWebhook
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы