def main():
    last_update_id = None
    mytask = HandleTask()
    while True:

        print("Updates")
        updates = mytask.get_updates(last_update_id)

        if len(updates["result"]) > 0:
            last_update_id = mytask.get_last_update_id(updates) + 1
            mytask.handle_updates(updates)

        time.sleep(0.5)
Example #2
0
#!/usr/bin/env python3

import time
from handletask import HandleTask

if __name__ == '__main__':
    last_update_id = None
    task = HandleTask()
    while True:
        print('Updates')
        updates = task.get_updates(last_update_id)

        if len(updates['result']) > 0:
            last_update_id = task.get_last_update_id(updates) + 1
            task.handle_updates(updates)

        time.sleep(0.5)