ó áŹ_Zc@sŞddlZddlZyddlZeZWnek rGeZnXddlmZddl m Z m Z m Z m Z ddlmZmZdefd„ƒYZdS( i˙˙˙˙Ni(t Connectioni(tConnectionErrortImproperlyConfiguredtConnectionTimeouttSSLError(t urlencodet string_typestRequestsHttpConnectionc BsSeZdZdddeeddddd„ Zdddddd„Zd„ZRS(sý Connection using the `requests` library. :arg http_auth: optional http auth information as either ':' separated string or a tuple. Any value will be passed into requests as `auth`. :arg use_ssl: use ssl for the connection if `True` :arg verify_certs: whether to verify SSL certificates :arg ca_certs: optional path to CA bundle. By default standard requests' bundle will be used. :arg client_cert: path to the file containing the private key and the certificate, or cert only if using client_key :arg client_key: path to the file containing the private key if using separate cert and key files (client_cert will contain only the cert) :arg headers: any custom http headers to be add to requests t localhostiđ#c Ks™tstdƒ‚ntt|ƒjd|d|d|| tjƒ|_| pUi|j_|jjj ddƒ|dk rÝt |t t fƒr¤t |ƒ}n*t |tƒrÎt |jddƒƒ}n||j_nd |jrďd nd |||jf|_||j_|s)||j_n|rD||f|j_n|rn|s_td ƒ‚n||j_n|jr•| r•tjd |jƒndS(Ns6Please install requests to use RequestsHttpConnection.thosttporttuse_ssls content-typesapplication/jsont:ishttp%s://%s:%d%ststs7You cannot pass CA certificates when verify SSL is off.s?Connecting to %s using SSL with verify_certs=False is insecure.(tREQUESTS_AVAILABLERtsuperRt__init__trequeststSessiontsessiontheaderst setdefaulttNonet isinstancettupletlistRtsplittauthR t url_prefixtbase_urltverifytcerttwarningstwarn( tselfR R t http_authR t verify_certstca_certst client_certt client_keyRtkwargs((s/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-W9yz6j/elasticsearch/elasticsearch/connection/http_requests.pyRs6(  c CsI|j|}|r2d|t|p%iƒf}ntjƒ}tjd|d|d|d|ƒ} |jj| ƒ} |jj| jidddƒ} i|p¤|j d6} | j | ƒy2|jj | | } tjƒ|}| j }Wn´tk r }|j||| j|tjƒ|d|ƒt|tjjƒrXtdt|ƒ|ƒ‚nt|tjƒr…td t|ƒ|ƒ‚ntdt|ƒ|ƒ‚nXd | jkoťd kn r| j|kr|j||| jj||| j|ƒ|j| j|ƒn|j||| jj|| j||ƒ| j| j|fS( Ns%s?%stmethodRturltdatattimeoutt exceptionsN/AtTIMEOUTiČi,(RRttimeRtRequestRtprepare_requesttmerge_environment_settingsR+RR-tupdatetsendttextt Exceptiontlog_request_failtpath_urlRt exceptionsRtstrtTimeoutRRt status_codetrequestt _raise_errortlog_request_successR(R#R*R+tparamstbodyR-tignoreRtstartR>tprepared_requesttsettingst send_kwargstresponsetdurationtraw_datate((s/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-W9yz6j/elasticsearch/elasticsearch/connection/http_requests.pytperform_request@s2  $!  ,/((cCs|jjƒdS(s/ Explicitly closes connections N(Rtclose(R#((s/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-W9yz6j/elasticsearch/elasticsearch/connection/http_requests.pyRM`sN(( t__name__t __module__t__doc__RtFalsetTrueRRLRM(((s/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-W9yz6j/elasticsearch/elasticsearch/connection/http_requests.pyR s   ! (R0R!RRRRt ImportErrorRQtbaseRR:RRRRtcompatRRR(((s/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-W9yz6j/elasticsearch/elasticsearch/connection/http_requests.pyts      "