#NEWLINE# def getPublicIP( self , error = None ) : #NEWLINE# #INDENT# if ( len ( self . ip_functions ) > 0 ) : #NEWLINE# #INDENT# func = self . ip_functions . pop ( ) #NEWLINE# d = func ( ) #NEWLINE# d . addCallback ( self . _getPublicIPCallback ) #NEWLINE# d . addErrback ( self . getPublicIP ) #NEWLINE# return error #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . error ( 'Unable to get public IP address. Check your network connection' ) #NEWLINE# response = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( self . local_ip is not None ) : #NEWLINE# #INDENT# response [ 'local_ip' ] = self . local_ip #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# response [ 'local_ip' ] = socket . gethostbyname ( socket . gethostname ( ) ) #NEWLINE# #UNINDENT# return response