#NEWLINE# def request( self , path , method = 'GET' , params = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# url = urljoin ( ENDPOINT , path ) #NEWLINE# headers = { #NEWLINE# #INDENT# 'Accept' : 'application/json' , #NEWLINE# 'Authorization' : ( 'AccessKey ' + self . access_key ) , #NEWLINE# 'User-Agent' : ( 'MessageBird/ApiClient/%s Python/%s' % ( CLIENT_VERSION , PYTHON_VERSION ) ) , #NEWLINE# 'Content-Type' : 'application/json' , #NEWLINE# #UNINDENT# } #NEWLINE# if ( method == 'GET' ) : #NEWLINE# #INDENT# response = requests . get ( url , verify = True , headers = headers , params = params ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# response = requests . post ( url , verify = True , headers = headers , data = json . dumps ( params ) ) #NEWLINE# #UNINDENT# if ( response . status_code in self . _supported_status_codes ) : #NEWLINE# #INDENT# json_response = response . json ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# response . raise_for_status ( ) #NEWLINE# #UNINDENT# if ( 'errors' in json_response ) : #NEWLINE# #INDENT# raise ErrorException ( [ Error ( ) . load ( e ) for e in json_response [ 'errors' ] ] ) #NEWLINE# #UNINDENT# return json_response