#NEWLINE# def _request( self , method , body , url , content_type = None , version = None , params = None ) : #NEWLINE# #INDENT# headers = { #NEWLINE# #INDENT# 'User-agent' : 'UAPythonLib/{0}' . format ( __about__ . __version__ ) , #NEWLINE# #UNINDENT# } #NEWLINE# if content_type : #NEWLINE# #INDENT# headers [ 'content-type' ] = content_type #NEWLINE# #UNINDENT# if ( version is not None ) : #NEWLINE# #INDENT# headers [ 'Accept' ] = ( 'application/vnd.urbanairship+json; version=%d;' % version ) #NEWLINE# #UNINDENT# logger . debug ( 'Making %s request to %s. Headers:\n\t%s\nBody:\n\t%s' , method , url , '\n\t' . join ( ( ( '%s: %s' % ( key , value ) ) for ( key , value ) in headers . items ( ) ) ) , body ) #NEWLINE# response = self . session . request ( method , url , data = body , params = params , headers = headers ) #NEWLINE# logger . debug ( 'Received %s response. Headers:\n\t%s\nBody:\n\t%s' , response . status_code , '\n\t' . join ( ( ( '%s: %s' % ( key , value ) ) for ( key , value ) in response . headers . items ( ) ) ) , response . content ) #NEWLINE# if ( response . status_code == 401 ) : #NEWLINE# #INDENT# raise common . Unauthorized #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not ( 200 <= response . status_code < 300 ) ) : #NEWLINE# #INDENT# raise common . AirshipFailure . from_response ( response ) #NEWLINE# #UNINDENT# #UNINDENT# return response