\h6ddlmZddlZddlZddlZddlZddlZddlZddlmZ ddlm Z ddl m Z mZmZmZmZmZmZmZddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"ddl#m$Z$dd l%m&Z&dd l'm(Z(dd l)m*Z*dd l+m,Z,dd l-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;mZ?ddl;m@Z@mAZA ddlBZBeBjZDe$jjZHejeJZKeLZMGddeLZNejejhZQGddeNe(ZRGddeRZSdZTdZ>d ZUy#eE$r ddlFmDZDYwxYw)!)absolute_importN)errortimeout) BaseSSLErrorBrokenPipeErrorDummyConnectionHTTPConnection HTTPExceptionHTTPSConnectionVerifiedHTTPSConnectionport_by_scheme) ClosedPoolErrorEmptyPoolErrorHeaderParsingErrorHostChangedErrorInsecureRequestWarningLocationValueError MaxRetryErrorNewConnectionError ProtocolError ProxyErrorReadTimeoutErrorSSLError TimeoutError)six)queue)RequestMethods) HTTPResponse)is_connection_dropped)connection_requires_http_tunnel) LifoQueue)set_file_position)assert_header_parsing)Retry)CertificateError)Timeout)Url_encode_target)_normalize_host)get_host parse_url)weakref_finalizec8eZdZdZdZeZddZdZdZ dZ dZ y) ConnectionPoola; Base class for all connection pools, such as :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. .. note:: ConnectionPool.urlopen() does not normalize or percent-encode target URIs which is useful if your target server doesn't support percent-encoded target URIs. Nc|s tdt||j|_|j |_||_y)NzNo host specified.scheme)rr+r3hostlower _proxy_hostport)selfr4r7s e/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_vendor/urllib3/connectionpool.py__init__zConnectionPool.__init__Rs8$%9: :#D= ::< cft|jd|jd|jdS)Nz(host=z, port=))type__name__r4r7r8s r9__str__zConnectionPool.__str__Zs!)-d)<)Pool reached maximum size and no more connections are allowed.z Resetting dropped connection: %s auto_openrr)r_getr`AttributeErrorrrEmptyrr!rqrrr4rGgetattrrw)r8rrvs r9 _get_connzHTTPConnectionPool._get_conns 99==tzz7=CD )$/ II8$)) D JJLt[!,1't~~''+ ;!$(9: :{{ zz$T   s'B?CCc  |jj|dy#t$rYnQtj$r<t j d|j|jjYnwxYw|r|jyy)a Put a connection back into the pool. :param conn: Connection object for the current host and port as returned by :meth:`._new_conn` or :meth:`._get_conn`. If the pool is already full, the connection is closed and discarded because we exceeded maxsize. If connections are discarded frequently, then maxsize should be increased. If the pool is closed, then the connection will be closed and discarded. Fr`NzLConnection pool is full, discarding connection: %s. Connection pool size: %s) r_rcr{rFullrqwarningr4qsizerGrus r9 _put_connzHTTPConnectionPool._put_conn,ss  IIMM$eM ,   zz  KK^  !    JJL s A9A A98A9cy)U Called right before a request is made, after the socket is created. NrDrus r9_validate_connz!HTTPConnectionPool._validate_connKrNr;cyrCrDrus r9_prepare_proxyz!HTTPConnectionPool._prepare_proxyQs r;c|tur|jjSt|tr|jSt j |S)z:Helper that always returns a :class:`urllib3.util.Timeout`)_Defaultrcloner[r(r\)r8rs r9 _get_timeoutzHTTPConnectionPool._get_timeoutUsF h <<%%' ' gw '==? "%%g. .r;ct|trt||d|zt|dr"|jt vrt||d|zdt |vs dt |vrt||d|zy)zAIs the error actually a timeout? Will raise a ReadTimeout or pass!Read timed out. (read timeout=%s)errnoz timed outzdid not complete (read)N)r[ SocketTimeoutrhasattrr_blocking_errnosstr)r8errurl timeout_values r9_raise_timeoutz!HTTPConnectionPool._raise_timeoutas c= )"c>N  3 SYY2B%B"c>N  #c( "&?3 D ' #c>N ' r;c |xjdz c_|j|}|jtj|j |_ |j| |r|j||fi|n|j||fi||j&} t)|ddrp| dk(rt+||d| z| tj,ur.|j.j1t3j4n|j.j1|  |j7d} t)|d d } tBjEd |jF|jH|jJ|||  jL| jN  tQ| jR| S#ttf$r$}|j|||j d}~wwxYw#t$rYSt$rG}|jtj tj"tj$hvrYd}~d}~wwxYw#t8$rB |j7} n,#t:$r }t=j>|dYd}~nd}~wwxYwYRwxYw#ttt@f$r}|j||| d}~wwxYw#tTt8f$r3} tBjWd |jY|| d Yd} ~ | Sd} ~ wwxYw)a Perform a request on a given urllib connection object taken from our pool. :param conn: a connection from one of our connection pools :param timeout: Socket timeout in seconds for the request. This can be a float or integer, which will set the same timeout value for the socket connect and the socket read, or an instance of :class:`urllib3.util.Timeout`, which gives you more fine-grained control over your timeouts. r)rrrNsockrrT) buffering _http_vsn_strzHTTP/?z%s://%s:%s "%s %s %s" %s %sz$Failed to parse headers (url=%s): %s)exc_info)-rer start_connectr(resolve_default_timeoutrtrrrrrrequest_chunkedrequestr IOErrorrEPIPE ESHUTDOWN EPROTOTYPE read_timeoutr}rDEFAULT_TIMEOUTr settimeoutsocketgetdefaulttimeout getresponse TypeError BaseExceptionr raise_from SocketErrorrqrrr3r4r7statuslengthr%msgrr _absolute_url) r8rvmethodrrchunkedhttplib_request_kw timeout_objerhttplib_response http_versionhpes r9 _make_requestz HTTPConnectionPool._make_requestzs" Q''0 !!#66{7R7RS      % $$$VSG4FG VS?,>?(#//  4 & q &#B\Qw666 $$V%=%=%?@ $$\2  ,#'#3#3d#3#C t_h?  ) KK II II     # #  # #   !"2"6"6 7 w|,    A3dll  K      ww      F ,,'+'7'7'9$$,NN1d++ ,  ,|[9    A3l  K  (#I.  KK6""3'     sF*.+G $H>J=*G9GG H;,H;4 J IJ  J"I=8J =JJ J J  J J: J55J:=K? (K::K?cpt|j|j|j|jS)N)r3r4r7path)r)r3r4r7r)r8rs r9rz HTTPConnectionPool._absolute_urls%$++DIIDIIDQUUUr;c\|jy|jdc}|_t|yrM)r_rh)r8old_pools r9rGzHTTPConnectionPool.closes- 99  "ii$) )r;cH|jdryt|\}}}| t||}|jr|st j |}n&|js|t j |k(rd}|||f|j |j|jfk(S)zj Check if the given ``url`` is a member of the same host as this connection pool. /TNr2) startswithr,r+r7rrzr3r4)r8rr3r4r7s r9 is_same_hostzHTTPConnectionPool.is_same_hosts >># &c]d  "47D 99T!%%f-Dt~'9'9&'AADd# TYY 'JJJr;Tc t|}|j}| |j}t|ts"t j |||j }| | jdd} |r|j|s t||||jdrtjt|}ntj|j}d}| }t|j |j"|}|s+|j%}|j'|j(d}d}t+|| } |j-|}|j/| }|j0|_|j duxrt5|dd }|r|r|j7||j9||||||| }| s|nd}|| d <|j:j<|f|||d | }d}|s|xr|j[}d}|r|j]| |s7t^jad||||jb|||||||f|| | | | d| S|xrje}|r~jfdk(rd} |jS||||}|jm|jo|t^jqd|||jb||||f||||| | | | d| Stsjjd}|ju||jf|rl |jS||||}|jm|jY|t^jqd||jb||||f||||| | | | d| S|S#t>$rd}d}t@tBtDtFtHtJtLf$r}d}d }t|tHrO|j rC||r;|j r/|j jd k(rtOdtK|}nst|tHtLfr tK|}nQt|tDtPfr|j r tOd|}n"t|tDtBfr tGd|}|jS||||tUjVd}|jY|}Yd}~d}~wwxYw#|s|xr|j[}d}|r|j]|wwxYw#th$r"|jjr|jm|cYSwxYw#th$r"|jvr|jm|cYSwxYw)a+ Get a connection from the pool and perform an HTTP request. This is the lowest level call for making a request, so you'll need to specify all the raw details. .. note:: More commonly, it's appropriate to use a convenience method provided by :class:`.RequestMethods`, such as :meth:`request`. .. note:: `release_conn` will only behave as expected if `preload_content=False` because we want to make `preload_content=False` the default behaviour someday soon without breaking backwards compatibility. :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL to perform the request on. :param body: Data to send in the request body, either :class:`str`, :class:`bytes`, an iterable of :class:`str`/:class:`bytes`, or a file-like object. :param headers: Dictionary of custom headers to send, such as User-Agent, If-None-Match, etc. If None, pool headers are used. If provided, these headers completely replace any pool-specific headers. :param retries: Configure the number of retries to allow before raising a :class:`~urllib3.exceptions.MaxRetryError` exception. Pass ``None`` to retry until you receive a response. Pass a :class:`~urllib3.util.retry.Retry` object for fine-grained control over different types of retries. Pass an integer number to retry connection errors that many times, but no other types of errors. Pass zero to never retry. If ``False``, then retries are disabled and any exception is raised immediately. Also, instead of raising a MaxRetryError on redirects, the redirect response will be returned. :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. :param redirect: If True, automatically handle redirects (status codes 301, 302, 303, 307, 308). Each redirect counts as a retry. Disabling retries will disable redirect, too. :param assert_same_host: If ``True``, will make sure that the host of the pool requests is consistent else will raise HostChangedError. When ``False``, you can use the pool on an HTTP proxy and request foreign hosts. :param timeout: If specified, overrides the default timeout for this one request. It may be a float (in seconds) or an instance of :class:`urllib3.util.Timeout`. :param pool_timeout: If set and the pool is set to block=True, then this method will block for ``pool_timeout`` seconds and raise EmptyPoolError if no connection is available within the time period. :param release_conn: If False, then the urlopen call will not release the connection back into the pool once a response is received (but will release if you read the entire contents of the response such as when `preload_content=True`). This is useful if you're not preloading the response's content immediately. You will need to call ``r.release_conn()`` on the response ``r`` to return the connection back into the pool. If None, it takes the value of ``response_kw.get('preload_content', True)``. :param chunked: If True, urllib3 will send the body using chunked transfer encoding. Otherwise, urllib3 will send the body using the standard content-length form. Defaults to False. :param int body_pos: Position to seek to in file-like body in the event of a retry or redirect. Typically this won't need to be set because urllib3 will auto-populate the value when needed. :param \**response_kw: Additional parameters are passed to :meth:`urllib3.response.HTTPResponse.from_httplib` N)redirectdefaultpreload_contentTrFrr)rbodyrjrrequest_method)r_ connectionr^cdjtjdt|j }d|vxsd|vS)N z[^a-z]zwrong version numberzunknown protocol)joinresplitrr5) ssl_errormessages r9%_is_ssl_error_message_from_http_proxyzIHTTPConnectionPool.urlopen.._is_ssl_error_message_from_http_proxysB((288Hc)n6J6J6L#MN*g5V9Kw9Vr;httpszYour proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxyzCannot connect to proxy.zConnection aborted.)r_pool _stacktracez1Retrying (%r) after connection broken by '%r': %s)r pool_timeout release_connrbody_posi/GET)responserzRedirecting %s -> %s)r^rassert_same_hostrrrrrz Retry-Afterz Retry: %s)># ..!45C..0C)> JJ))+= $llnG NN4-- . %T84w %++G4K>>,>7D&66DL $ $ 6!wfd@< !%9##D) $11# 2  )5D$M-3K( )5t''44 (   HJ@ , $(! t$ KKCWcSV  4<<  ))! "%I)G)G)I #% !++FC(RV+W    !  # #H - II,c3D E4<<!   !!1))! "x//33MBC   FHOO_ E !++FC(RV+W    ! MM( # IIk3 '4<<   !!1))!  A J %          5 J 1l+JJ9!<JJJJ%%04QK A .>?@QKA -?@Adjj91=A ];<!"7;''1DcllnQ>O(G MMOCk5 p , $(! t$ !F! ,,'')  <! **'')  sP>B-N8T&U 6S( DS#S+#S((S++.T(UU (U54U5rC)r?rOrPrQr3r rsr rr(rr:rwr~rrrrrrrrrGrrrDr;r9rTrTps9vF"MK ''>>@*%(N>   /4*25u nV *K2tr;rTc|eZdZdZdZeZddejdddddddddddddddfdZ dZ dZ d Z fd Z xZS) HTTPSConnectionPoola Same as :class:`.HTTPConnectionPool`, but HTTPS. :class:`.HTTPSConnection` uses one of ``assert_fingerprint``, ``assert_hostname`` and ``host`` in this order to verify connections. If ``assert_hostname`` is False, no verification is done. The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs``, ``ca_cert_dir``, ``ssl_version``, ``key_password`` are only used if :mod:`ssl` is available and are fed into :meth:`urllib3.util.ssl_wrap_socket` to upgrade the connection socket into an SSL socket. rNFrc tj|||||||||| | f i|| |_| |_| |_||_||_||_||_||_ ||_ yrC) rTr:key_file cert_file cert_reqs key_passwordca_certs ca_cert_dir ssl_versionassert_hostnameassert_fingerprint)r8r4r7rZrrir`rjr^rkrlrrrrrrrrrrfs r9r:zHTTPSConnectionPool.__init__s0 ##             ! ""(  &&."4r;c t|trz|j|j|j|j |j |j|j|j|j|j|_ |S)z Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket` and establish the tunnel if proxy is used. )rrrrrrrr) r[rset_certrrrrrrrrrrus r9 _prepare_connz!HTTPSConnectionPool._prepare_connsu d3 4 MM!...... ,, $ 4 4#'#:#:   $//D  r;c|j|j|j|j|jj dk(rd|_|jy)z Establishes a tunnel connection through HTTP CONNECT. Tunnel connection is established early because otherwise httplib would improperly set Host: header to proxy's IP:port. rTN) set_tunnelr6r7rarXr3tls_in_tls_requiredconnectrus r9rz"HTTPSConnectionPool._prepare_proxysG (($))T5G5GH ::   ''+D $ r;c t|xjdz c_tjd|j|j|jxsd|j r|j t ur td|j}|j}|j,|jj}|jj}|j d|||jj|j|j|j|jd|j}|j!|S)zF Return a fresh :class:`http.client.HTTPSConnection`. rz)Starting new HTTPS connection (%d): %s:%s443zCCan't connect to HTTPS URL because the SSL module is not available.)r4r7rrZrrrrD)rdrqrrr4r7rsr rrXrrtrZrrrrfr)r8 actual_host actual_portrvs r9rwzHTTPSConnectionPool._new_conns  ! 7  II II   !!T%7%7?%JU ii ii :: !**//K**//K!t!!  LL00;;nn]]**  ll  !!$''r;c tt| |t|dds|j |j s't jd|jztt|dddurt jdtyy)rrNzUnverified HTTPS request is being made to host '%s'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warningsproxy_is_verifiedFzUnverified HTTPS connection done to an HTTPS proxy. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings) superrrr}r  is_verifiedwarningswarnr4r)r8rv __class__s r9rz"HTTPSConnectionPool._validate_conns !47=tVT* LLN MM$'+ii0 '  4,d 3u < MM$ '  =r;)r?rOrPrQr3r rsr(rr:rrrwr __classcell__)rs@r9rrsr F#M '')/5b( "(Hr;rc t|\}}}|xstj|d}|dk(rt|fd|i|St |fd|i|S)a Given a url, return an :class:`.ConnectionPool` instance of its host. This is a shortcut for not having to parse out the scheme, host, and port of the url before creating an :class:`.ConnectionPool` instance. :param url: Absolute URL string that must include the scheme. Port is optional. :param \**kw: Passes additional parameters to the constructor of the appropriate :class:`.ConnectionPool`. Useful for specifying things like timeout, maxsize, headers, etc. Example:: >>> conn = connection_from_url('http://google.com/') >>> r = conn.request('GET', '/') Prr7)r,rrzrrT)rkwr3r4r7s r9connection_from_urlr6s]("#FD$  1>%%fb1D "49d9b99!$8T8R88r;clt||}|jdr|jdr|dd}|S)z? Normalize hosts for comparisons and use with sockets. []r)normalize_hostrendswith)r4r3s r9r+r+Rs9 $ 'D s c 2Abz Kr;c |jd}|r|j%#tj$rYywxYw)z2Drains a queue of connections and closes each one.FrN)rzrGrr|)r_rvs r9rhrhdsC 88%8(D  ;;   s &(>>)V __future__rrloggingrrrrrrrrrrr r r r r rr exceptionsrrrrrrrrrrrrrpackagesrpackages.six.movesrrrrr util.connectionr! util.proxyr" util.queuer# util.requestr$ util.responser% util.retryr&util.ssl_match_hostnamer' util.timeoutr(util.urlr)r*r+r r,r-weakreffinalizer.r{#packages.backports.weakref_finalizemovesrb getLoggerr?rqobjectrr0EAGAIN EWOULDBLOCKrrTrrrhrDr;r9r9s&  '+   %#"27!+05!)7)F''   g! 8% V% RLL%"3"34Y Y xg,gT98$ W!FEFs<D?? E  E