#NEWLINE# def send_request( self , method , path , body = None , query_string_args = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , encode_json = True ) : #NEWLINE# #INDENT# "Make a raw HTTP request to ElasticSearch.\n\n        You may use this method to manually do whatever is not (yet) supported\n        by ESClient. This method does not return anything, but sets the class\n        variable called last_response, which is the response object returned\n        by the requests library.\n\n        Arguments:\n        method -- HTTP method, e.g. 'GET', 'PUT', 'DELETE', etc.\n        path -- URL path\n        body -- the body, as a hierachy of Python objects that is parseable\n                to JSON with json.dumps()\n        query_string_args -- the query string arguments, which are the\n        key=value pairs after the question mark in any URL.\n\n        " #NEWLINE# if query_string_args : #NEWLINE# #INDENT# path = '?' . join ( [ path , urlencode ( query_string_args ) ] ) #NEWLINE# #UNINDENT# kwargs = { #NEWLINE# #INDENT# 'timeout' : self . request_timeout , #NEWLINE# #UNINDENT# } #NEWLINE# url = ( self . es_url + path ) #NEWLINE# if body : #NEWLINE# #INDENT# if encode_json : #NEWLINE# #INDENT# kwargs [ 'data' ] = json . dumps ( body ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# kwargs [ 'data' ] = body #NEWLINE# #UNINDENT# #UNINDENT# if ( not hasattr ( requests , method . lower ( ) ) ) : #NEWLINE# #INDENT# raise ESClientException ( ( "No such HTTP Method '%s'!" % method . upper ( ) ) ) #NEWLINE# #UNINDENT# self . last_response = requests . request ( method . lower ( ) , url , ** kwargs ) #NEWLINE# log . debug ( self . last_response )