#NEWLINE# def renew( self , events = None ) : #NEWLINE# #INDENT# if events : #NEWLINE# #INDENT# self . set_events ( events ) #NEWLINE# #UNINDENT# if ( not self . alive ( ) ) : #NEWLINE# #INDENT# raise Exception ( 'Subscription is not alive' ) #NEWLINE# #UNINDENT# if ( ( not self . _event_filters ) or ( len ( self . _event_filters ) == 0 ) ) : #NEWLINE# #INDENT# raise Exception ( 'Events are undefined' ) #NEWLINE# #UNINDENT# self . _clear_timeout ( ) #NEWLINE# try : #NEWLINE# #INDENT# response = self . _platform . put ( ( '/restapi/v1.0/subscription' + self . _subscription [ 'id' ] ) , body = { #NEWLINE# #INDENT# 'eventFilters' : self . _get_full_events_filter ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . set_subscription ( response . json_dict ( ) ) #NEWLINE# self . emit ( Events . renewSuccess , response ) #NEWLINE# return response #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . reset ( ) #NEWLINE# self . emit ( Events . renewError , e ) #NEWLINE# raise