#NEWLINE# @ gen . coroutine #NEWLINE# def _listen_commands( self ) : #NEWLINE# #INDENT# self . _last_update = None #NEWLINE# update_body = { #NEWLINE# #INDENT# 'timeout' : 2 , #NEWLINE# #UNINDENT# } #NEWLINE# update_headers = { #NEWLINE# #INDENT# 'Content-Type' : 'application/json' , #NEWLINE# #UNINDENT# } #NEWLINE# while True : #NEWLINE# #INDENT# if self . _last_update : #NEWLINE# #INDENT# update_body . update ( { #NEWLINE# #INDENT# 'offset' : ( self . _last_update + 1 ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# update_resp = self . client . fetch ( ( self . url + 'getUpdates' ) , headers = update_headers , body = json . dumps ( update_body ) , method = 'POST' ) #NEWLINE# update_resp . add_done_callback ( self . _respond_commands ) #NEWLINE# ( yield gen . sleep ( 5 ) )