interval = data.vk_interval
t = threading.Thread(target=vkListener, args=(interval,))
t.daemon = True
t.start()
# print(threading.enumerate())
botUpdate=myBot.get_updates()
myBot.polling(none_stop=True, interval=1)
time.sleep(1)
except ConnectionError:
logging.exception("We are offline. Retrying in 60 seconds.")
# logging.error(e)
time.sleep(60)Такой output:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "./mm-randbot.py", line 470, in vkListener
response = requests.get('https://api.vk.com/method/wall.get', params={'access_token': data.vk_token, 'owner_id': data.vkgroup_id, 'count': 1, 'offset': 0})
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 504, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='api.vk.com', port=443): Max retries exceeded with url: /method/wall.get?access_token=4e428ab44e428ab44e428ab4154e1fd0f644e424e428ab4172c885a1443a4a58a217759&count=1&offset=0&owner_id=-1441 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb456a1ec>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
ERROR:root:We are offline. Retrying in 60 seconds.
Traceback (most recent call last):
File "./mm-randbot.py", line 680, in <module>
botUpdate=myBot.get_updates()
File "/usr/local/lib/python2.7/dist-packages/telebot/__init__.py", line 129, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "/usr/local/lib/python2.7/dist-packages/telebot/apihelper.py", line 172, in get_updates
return _make_request(token, method_url, params=payload)
File "/usr/local/lib/python2.7/dist-packages/telebot/apihelper.py", line 51, in _make_request
timeout=(connect_timeout, read_timeout), proxies=proxy)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 504, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot441743981:AAGhgO5Tgo8tw8YQUKWSMqp2ATS-_N7hz8g/getUpdates?timeout=20 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb456a92c>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
^CTraceback (most recent call last):
File "./mm-randbot.py", line 686, in <module>
time.sleep(60)
Так у тебя в консоли логгер вылезает
Обсуждают сегодня