import data
import requests
import updates
token = ''
data = requests.get('https://api.vk.com/method/messages.getLongPollServer',
params={'access_token': token, 'v': 5.80}).json()['response']
while True:
response = requests.get('https://{server}?act=a_check&key={key}&ts={ts}&wait=20&mode=2&version=2'.format(server=data['server'], key=data['key'], ts=data['ts'])).json()
if updates:
for element in updates:
print(element)
data['ts'] = response['ts']