Stability improvemements [2]
This commit is contained in:
parent
c6ad06ddd7
commit
43a617394a
1
bot.py
1
bot.py
@ -30,6 +30,7 @@ vk_tokens = redis.StrictRedis(connection_pool=tokens_pool)
|
|||||||
currentchat = {}
|
currentchat = {}
|
||||||
|
|
||||||
bot = telebot.AsyncTeleBot(token)
|
bot = telebot.AsyncTeleBot(token)
|
||||||
|
bot.remove_webhook()
|
||||||
|
|
||||||
link = 'https://oauth.vk.com/authorize?client_id={}&' \
|
link = 'https://oauth.vk.com/authorize?client_id={}&' \
|
||||||
'display=page&redirect_uri=https://oauth.vk.com/blank.html&scope=friends,messages,offline,docs,photos,video' \
|
'display=page&redirect_uri=https://oauth.vk.com/blank.html&scope=friends,messages,offline,docs,photos,video' \
|
||||||
|
@ -4,7 +4,6 @@ import redis
|
|||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
import vk
|
import vk
|
||||||
from vk.exceptions import VkAPIError
|
|
||||||
import wget
|
import wget
|
||||||
|
|
||||||
logging.basicConfig(format='%(levelname)-8s [%(asctime)s] %(message)s', level=logging.WARNING, filename='vk.log')
|
logging.basicConfig(format='%(levelname)-8s [%(asctime)s] %(message)s', level=logging.WARNING, filename='vk.log')
|
||||||
@ -284,7 +283,7 @@ class VkMessage:
|
|||||||
api = vk.API(self.session)
|
api = vk.API(self.session)
|
||||||
try:
|
try:
|
||||||
new = api.messages.getLongPollHistory(ts=self.ts, pts=self.pts)
|
new = api.messages.getLongPollHistory(ts=self.ts, pts=self.pts)
|
||||||
except VkAPIError.code == 10:
|
except:
|
||||||
timeout = 3
|
timeout = 3
|
||||||
logging.warning('Retrying getLongPollHistory in {} seconds'.format(timeout))
|
logging.warning('Retrying getLongPollHistory in {} seconds'.format(timeout))
|
||||||
time.sleep(timeout)
|
time.sleep(timeout)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user