#NEWLINE# def _request( self , url , params = None , files = None , method = 'GET' , check_for_errors = True ) : #NEWLINE# #INDENT# url = self . _resolve_url ( url ) #NEWLINE# self . log . info ( '{method} {url!r} with params {params!r}' . format ( method = method , url = url , params = params ) ) #NEWLINE# if ( params is None ) : #NEWLINE# #INDENT# params = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if self . access_token : #NEWLINE# #INDENT# params [ 'access_token' ] = self . access_token #NEWLINE# #UNINDENT# methods = { #NEWLINE# #INDENT# 'GET' : self . rsession . get , #NEWLINE# 'POST' : functools . partial ( self . rsession . post , files = files ) , #NEWLINE# 'PUT' : self . rsession . put , #NEWLINE# 'DELETE' : self . rsession . delete , #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# requester = methods [ method . upper ( ) ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise ValueError ( 'Invalid/unsupported request method specified: {0}' . format ( method ) ) #NEWLINE# #UNINDENT# raw = requester ( url , params = params ) #NEWLINE# if check_for_errors : #NEWLINE# #INDENT# self . _handle_protocol_error ( raw ) #NEWLINE# #UNINDENT# if ( raw . status_code in [ 204 ] ) : #NEWLINE# #INDENT# resp = [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# resp = raw . json ( ) #NEWLINE# #UNINDENT# self . rate_limiter ( ) #NEWLINE# return resp