#coding: utf-8
import requests
import time
requests.packages.urllib3.disable_warnings()
offset=0
while True:
time.sleep(3)
offset=offset+1
request = requests.get("https://api.telegram.org/bot<token>/getUpdates?offset="+str(offset)+"&limit=5")
print offset
f = open('test','a')
for update in request.json()['result']:
offset = update['update_id']
f.write(str(update['update_id'])+'\n')
f.close()