/usr/local/lib/python3.6/site-packages/urllib3/__pycache__
NameSizeModeActions
connection.cpython-36.pyc138070644editdlrm
connectionpool.cpython-36.pyc258530644editdlrm
exceptions.cpython-36.pyc120020644editdlrm
fields.cpython-36.pyc81020644editdlrm
filepost.cpython-36.pyc27100644editdlrm
poolmanager.cpython-36.pyc152340644editdlrm
request.cpython-36.pyc62610644editdlrm
response.cpython-36.pyc222530644editdlrm
_collections.cpython-36.pyc111800644editdlrm
_version.cpython-36.pyc1640644editdlrm
__init__.cpython-36.pyc25350644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/urllib3/__pycache__/connectionpool.cpython-36.pyc (25853B)
3 Eg؝ @s(ddlmZddlZddlZddlZddlZddlZddlZddlmZ ddlm Z ddl m Z ddlmZmZmZmZmZmZmZmZddlmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#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>m?Z?ddl=m@ZAddl=mBZBmCZCyddlDZDeDjEZFWn"eGk rddlHmFZFYnXe&jIjJZJejKeLZMeNZOGdddeNZPejQejRhZSGdddePe*ZTGdddeTZUdd ZVd!d"Z@d#d$ZWdS)%)absolute_importN)error)timeout)HTTPHeaderDict) 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_finalizec@sBeZdZdZdZeZd ddZddZddZ d d Z d d Z dS)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. NcCs0|s tdt||jd|_|j|_||_dS)NzNo host specified.)scheme)rr*r/hostlower _proxy_hostport)selfr0r3r5@/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py__init__Ss  zConnectionPool.__init__cCsdt|j|j|jfS)Nz%s(host=%r, port=%r))type__name__r0r3)r4r5r5r6__str__[szConnectionPool.__str__cCs|S)Nr5)r4r5r5r6 __enter__^szConnectionPool.__enter__cCs |jdS)NF)close)r4exc_typeexc_valexc_tbr5r5r6__exit__aszConnectionPool.__exit__cCsdS)zD Close all pooled connections and disable the pool. Nr5)r4r5r5r6r<fszConnectionPool.close)N) r9 __module__ __qualname____doc__r/r"QueueClsr7r:r;r@r<r5r5r5r6r.Es  r.c @seZdZdZdZeZeZdde j dddddddf ddZ dd Z d!d d Z d d ZddZddZddZddZedfddZddZddZddZdddddeddddf dd ZdS)"HTTPConnectionPoola: Thread-safe connection pool for one host. :param host: Host used for this HTTP Connection (e.g. "localhost"), passed into :class:`http.client.HTTPConnection`. :param port: Port used for this HTTP Connection (None is equivalent to 80), passed into :class:`http.client.HTTPConnection`. :param strict: Causes BadStatusLine to be raised if the status line can't be parsed as a valid HTTP/1.0 or 1.1 status line, passed into :class:`http.client.HTTPConnection`. .. note:: Only works in Python 2. This parameter is ignored in Python 3. :param timeout: Socket timeout in seconds for each individual connection. This can be a float or integer, which sets the timeout for the HTTP request, or an instance of :class:`urllib3.util.Timeout` which gives you more fine-grained control over request timeouts. After the constructor has been parsed, this is always a `urllib3.util.Timeout` object. :param maxsize: Number of connections to save that can be reused. More than 1 is useful in multithreaded situations. If ``block`` is set to False, more connections will be created but they will not be saved once they've been used. :param block: If set to True, no more than ``maxsize`` connections will be used at a time. When no free connections are available, the call will block until a connection has been released. This is a useful side effect for particular multithreaded situations where one does not want to use more than maxsize connections per host to prevent flooding. :param headers: Headers to include with all requests, unless other headers are given explicitly. :param retries: Retry configuration to use by default with requests in this pool. :param _proxy: Parsed proxy URL, should not be used directly, instead, see :class:`urllib3.ProxyManager` :param _proxy_headers: A dictionary with proxy headers, should not be used directly, instead, see :class:`urllib3.ProxyManager` :param \**conn_kw: Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`, :class:`urllib3.connection.HTTPSConnection` instances. httpNFrc Kstj|||tj||||_t|ts4tj|}|dkrBtj}||_ ||_ |j ||_ ||_ | |_| pli|_| |_xt|D]} |j jdqWd|_d|_| |_|jr|jjdg|j|jd<|j|jd<|j }t|t|dS)Nrsocket_optionsproxy proxy_config)r.r7rstrict isinstancer' from_floatr%DEFAULTrretriesrDpoolblockrH proxy_headersrIxrangeputnum_connections num_requestsconn_kw setdefaultr-_close_pool_connections)r4r0r3rJrmaxsizerPheadersrN_proxy_proxy_headers _proxy_configrV_rOr5r5r6r7s2       zHTTPConnectionPool.__init__cCsR|jd7_tjd|j|j|jp$d|jf|j|j|jj|jd|j }|S)z9 Return a fresh :class:`HTTPConnection`. rz(Starting new HTTP connection (%d): %s:%s80)r0r3rrJ) rTlogdebugr0r3 ConnectionClsrconnect_timeoutrJrV)r4connr5r5r6 _new_conns  zHTTPConnectionPool._new_connc Csd}y|jj|j|d}WnBtk r8t|dYn&tjk r\|jrXt|dYnX|rt|rt j d|j |j t |dddkrd}|p|jS) a Get a connection. Will return a pooled connection if one is available. If no connections are available and :prop:`.block` is ``False``, then a fresh connection is returned. :param timeout: Seconds to wait before giving up and raising :class:`urllib3.exceptions.EmptyPoolError` if the pool is empty and :prop:`.block` is ``True``. N)rPrzPool is closed.z>Pool reached maximum size and no more connections are allowed.z Resetting dropped connection: %s auto_openrr)rOgetrPAttributeErrorrrEmptyrr r`rar0r<getattrre)r4rrdr5r5r6 _get_conns"  zHTTPConnectionPool._get_connc Csdy|jj|dddStk r(Yn,tjk rRtjd|j|jjYnX|r`|j dS)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. F)rPNzLConnection pool is full, discarding connection: %s. Connection pool size: %s) rOrSrhrFullr`warningr0qsizer<)r4rdr5r5r6 _put_conn-szHTTPConnectionPool._put_conncCsdS)zU Called right before a request is made, after the socket is created. Nr5)r4rdr5r5r6_validate_connLsz!HTTPConnectionPool._validate_conncCsdS)Nr5)r4rdr5r5r6_prepare_proxyRsz!HTTPConnectionPool._prepare_proxycCs2|tkr|jjSt|tr$|jStj|SdS)z:Helper that always returns a :class:`urllib3.util.Timeout`N)_DefaultrclonerKr'rL)r4rr5r5r6 _get_timeoutVs   zHTTPConnectionPool._get_timeoutcCsjt|trt||d|t|dr>|jtkr>t||d|dt|ksVdt|krft||d|dS)zAIs the error actually a timeout? Will raise a ReadTimeout or passz!Read timed out. (read timeout=%s)errnoz timed outzdid not complete (read)N)rK SocketTimeoutrhasattrru_blocking_errnosstr)r4errurl timeout_valuer5r5r6_raise_timeoutbs z!HTTPConnectionPool._raise_timeoutc HKsx|jd7_|j|}|jtj|j|_y|j|Wn:tt fk rv}z|j |||jdWYdd}~XnXy*|r|j ||f|n|j ||f|WnPt k rYn>tk r}z"|jtjtjtjtjhkrWYdd}~XnX|j} t|ddrL| dkr"t||d| | tjkr@|jjtjn |jj| yjy|jdd} WnTtk ry |j} Wn0tk r}ztj |dWYdd}~XnXYnXWn<tt t!fk r}z|j ||| dWYdd}~XnXt|d d } t"j#d |j$|j%|j&||| | j'| j( yt)| j*Wn@t+tfk rr} zt"j,d |j-|| dd WYdd} ~ XnX| S)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)rzr{r|Nsockrz!Read timed out. (read timeout=%s)T) buffering _http_vsn_strzHTTP/?z%s://%s:%s "%s %s %s" %s %sz$Failed to parse headers (url=%s): %s)exc_info).rUrt start_connectr'Zresolve_default_timeoutrcrrprvrr}request_chunkedrequestrIOErrorruEPIPE ESHUTDOWN EPROTOTYPE ECONNRESET read_timeoutrjrDEFAULT_TIMEOUTr~ settimeoutsocketgetdefaulttimeout getresponse TypeError BaseExceptionr raise_from SocketErrorr`rar/r0r3statuslengthr$msgrrm _absolute_url) r4rdmethodr{rchunkedhttplib_request_kw timeout_objerhttplib_response http_versionhper5r5r6 _make_request{sz      ( z HTTPConnectionPool._make_requestcCst|j|j|j|djS)N)r/r0r3path)r(r/r0r3r{)r4rr5r5r6rsz HTTPConnectionPool._absolute_urlcCs(|jdkrdS|jd}|_t|dS)zD Close all pooled connections and disable the pool. N)rOrX)r4old_poolr5r5r6r<s zHTTPConnectionPool.closecCs||jdrdSt|\}}}|dk r0t||d}|jrH| rHtj|}n|j rb|tj|krbd}|||f|j|j|jfkS)zj Check if the given ``url`` is a member of the same host as this connection pool. /TN)r/) startswithr+r*r3rrgr/r0)r4r{r/r0r3r5r5r6 is_same_hosts    zHTTPConnectionPool.is_same_hostTc /Kstt|}|j}|dkr|j}t|ts8tj|||jd}| dkrL| jdd} |rh|j| rht ||||j drt j t |}n t j |j}d}| }t|j|j|}|s|j}|j|jd}d}t|| } zy|j|}|j| d}|j|_|jdk o t|dd }|r$|r$|j||j||||||| d }| sF|nd}|| d <|jj|f|||d | }d}Wn"tk rd}d}Ynt t!t"t#t$t%t&fk r}zd}d d }t|t$r|jr||r|jr|jjdkrt'dt%|}nXt|t$t&fr"t%|}n>t|t"t(frF|jrFt'd|}nt|t"t!fr`t#d|}|j)||||t*j+dd}|j,|}WYdd}~XnXWd|s|o|j-}d}|r|j.|X|st/j0d||||j1|||||||f|| | | | d| S|o|j2}|r|j3dkr._is_ssl_error_message_from_http_proxyhttpszYour 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)rNrassert_same_hostrrrrrz Retry-Afterz Retry: %s)>r,r/rZrKr%from_intrNrgrrrr ensure_strr)r{r!rHrIcopyupdaterQr#rtrkrcrrjrqr ResponseCls from_httplibrrr rrrrr&rr incrementsysrsleepr<ror`rmurlopenget_redirect_locationrrZ_prepare_for_method_changerraise_on_redirect drain_connsleep_for_retryraboolis_retryraise_on_status)r4rr{rrZrNrrrrrrr response_kw parsed_urldestination_schemerdrelease_this_connhttp_tunnel_requiredrz clean_exitris_new_proxy_connr response_connrrrredirect_locationhas_retry_afterr5r5r6rs>m                           zHTTPConnectionPool.urlopen)N)r9rArBrCr/r rbrrr'rr7rerkrorprqrtr}rrrrr<rrr5r5r5r6rEqsF: 4 ' w rEcspeZdZdZdZeZddejdddddddddddddddfddZ dd Z d d Z d d Z fddZ ZS)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 Ks\tj|||||||||| | f || |_| |_| |_||_||_||_||_||_ ||_ dS)N) rEr7key_file cert_file cert_reqs key_passwordca_certs ca_cert_dir ssl_versionassert_hostnameassert_fingerprint)r4r0r3rJrrYrPrZrNr[r\rrrrrrrrrrVr5r5r6r7s,zHTTPSConnectionPool.__init__c Cs@t|tr<|j|j|j|j|j|j|j|j |j d|j |_ |S)z Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket` and establish the tunnel if proxy is used. )rrrrrrrr) rKr set_certrrrrrrrrr)r4rdr5r5r6 _prepare_conns  z!HTTPSConnectionPool._prepare_conncCs2|j|j|j|j|jjdkr&d|_|jdS)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_tunnelr2r3rQrHr/tls_in_tls_requiredconnect)r4rdr5r5r6rqs z"HTTPSConnectionPool._prepare_proxyc Cs|jd7_tjd|j|j|jp$d|j s:|jtkrBtd|j}|j}|jdk rh|jj}|jj}|jf|||j j |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.N)r0r3rrJrrr)rTr`rar0r3rbr rrHrrcrJrrrrVr)r4 actual_host actual_portrdr5r5r6res0   zHTTPSConnectionPool._new_conncs\tt|j|t|dds$|j|js>> conn = connection_from_url('http://google.com/') >>> r = conn.request('GET', '/') Prr3N)r+rrgrrE)r{kwr/r0r3r5r5r6connection_from_url>s rcCs.t||}|jdr*|jdr*|dd}|S)z? Normalize hosts for comparisons and use with sockets. []r)normalize_hostrendswith)r0r/r5r5r6r*Zs  r*c Cs>y"x|jdd}|r|jqWWntjk r8YnXdS)z2Drains a queue of connections and closes each one.F)rPN)rgr<rri)rOrdr5r5r6rXls rX)X __future__rruloggingrrrrrrrrv _collectionsrrrrr r r r r r exceptionsrrrrrrrrrrrrrpackagesrZpackages.six.movesrrrrrZutil.connectionr Z util.proxyr!Z util.queuer"Z util.requestr#Z util.responser$Z util.retryr%Zutil.ssl_match_hostnamer&Z util.timeoutr'Zutil.urlr(r)r*rr+r,weakreffinalizer-rhZ#packages.backports.weakref_finalizemovesrR getLoggerr9r`objectrrr.EAGAIN EWOULDBLOCKrxrErrrXr5r5r5r6s`    ( <               ) )+