1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
3

Z'íc·˜ã@sÞddlmZddlZddlZddlZddlZddlZddlZddlmZ	ddlm
Zddlm
Z
mZmZmZmZmZmZmZddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"ddl#m$Z$dd	l%m&Z&dd
l'm(Z(ddl)m*Z*ddl+m,Z,dd
l-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;m<Z<m=Z=ddl;m>Z?ddl;m@Z@mAZAe$jBjCZCejDeEƒZFeGƒZHGdd„deGƒZIejJejKhZLGdd„deIe(ƒZMGdd„deMƒZNdd„ZOdd „Z>dS)!é)Úabsolute_importN)Úerror)Útimeouté)ÚBaseSSLErrorÚBrokenPipeErrorÚDummyConnectionÚHTTPConnectionÚ
HTTPExceptionÚHTTPSConnectionÚVerifiedHTTPSConnectionÚport_by_scheme)
ÚClosedPoolErrorÚEmptyPoolErrorÚHeaderParsingErrorÚHostChangedErrorÚInsecureRequestWarningÚLocationValueErrorÚ
MaxRetryErrorÚNewConnectionErrorÚ
ProtocolErrorÚ
ProxyErrorÚReadTimeoutErrorÚSSLErrorÚ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_urlc@sBeZdZdZdZeZd
dd„Zdd„Zdd„Z	d	d
„Z
dd„ZdS)Ú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tdƒ‚t||jd|_|jƒ|_||_dS)NzNo host specified.)Úscheme)rr)r-ÚhostÚlowerÚ_proxy_hostÚport)Úselfr.r1©r3ú9/tmp/pip-build-gk9425m9/urllib3/urllib3/connectionpool.pyÚ__init__Ks

zConnectionPool.__init__cCsdt|ƒj|j|jfS)Nz%s(host=%r, port=%r))ÚtypeÚ__name__r.r1)r2r3r3r4Ú__str__SszConnectionPool.__str__cCs|S)Nr3)r2r3r3r4Ú	__enter__VszConnectionPool.__enter__cCs|jƒdS)NF)Úclose)r2Úexc_typeÚexc_valÚexc_tbr3r3r4Ú__exit__YszConnectionPool.__exit__cCsdS)zD
        Close all pooled connections and disable the pool.
        Nr3)r2r3r3r4r:^szConnectionPool.close)N)r7Ú
__module__Ú__qualname__Ú__doc__r-r!ÚQueueClsr5r8r9r>r:r3r3r3r4r,=s	
r,c
@sºeZdZdZdZeZeZdde	j
dddddddf
dd„Zdd	„Zd!d
d„Z
dd
„Zdd„Zdd„Zdd„Zdd„Zedfdd„Zdd„Zdd„Zdd„Zdddddeddddf
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KsÖtj|||ƒtj||ƒ||_t|tƒs4tj|ƒ}|dkrBtj}||_	||_
|j|ƒ|_||_
|	|_|
pli|_||_xt|ƒD]}
|jjdƒq€Wd|_d|_||_|jrÒ|jjdgƒ|j|jd<|j|jd<dS)NrÚsocket_optionsÚproxyÚproxy_config)r,r5rÚstrictÚ
isinstancer&Ú
from_floatr$ÚDEFAULTrÚretriesrBÚpoolÚblockrFÚ
proxy_headersrGÚxrangeÚputÚnum_connectionsÚnum_requestsÚconn_kwÚ
setdefault)r2r.r1rHrÚmaxsizerNÚheadersrLÚ_proxyÚ_proxy_headersZ
_proxy_configrTÚ_r3r3r4r5©s.


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:%sÚ80)r.r1rrH)
rRÚlogÚdebugr.r1Ú
ConnectionClsrÚconnect_timeoutrHrT)r2Úconnr3r3r4Ú	_new_connßs
zHTTPConnectionPool._new_conncCs d}y|jj|j|d}WnBtk
r8t|dƒ‚Yn&tjk
r\|jrXt|dƒ‚YnX|r”t|ƒr”t	j
d|jƒ|jƒt
|ddƒdkr”d}|pž|jƒS)	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)rNrzPool is closed.z>Pool reached maximum size and no more connections are allowed.z Resetting dropped connection: %sÚ	auto_openrr)rMÚgetrNÚAttributeErrorrrÚEmptyrrr\r]r.r:Úgetattrra)r2rr`r3r3r4Ú	_get_connôs"zHTTPConnectionPool._get_conncCsdy|jj|dddStk
r(Yn,tjk
rRtjd|j|jjƒƒYnX|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)rNNzLConnection pool is full, discarding connection: %s. Connection pool size: %s)
rMrQrdrÚFullr\Úwarningr.Úqsizer:)r2r`r3r3r4Ú	_put_connszHTTPConnectionPool._put_conncCsdS)zU
        Called right before a request is made, after the socket is created.
        Nr3)r2r`r3r3r4Ú_validate_conn:sz!HTTPConnectionPool._validate_conncCsdS)Nr3)r2r`r3r3r4Ú_prepare_proxy@sz!HTTPConnectionPool._prepare_proxycCs2|tkr|jjƒSt|tƒr$|jƒStj|ƒSdS)z:Helper that always returns a :class:`urllib3.util.Timeout`N)Ú_DefaultrÚclonerIr&rJ)r2rr3r3r4Ú_get_timeoutDs


zHTTPConnectionPool._get_timeoutcCsjt|tƒrt||d|ƒ‚t|dƒr>|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)rIÚ
SocketTimeoutrÚhasattrrqÚ_blocking_errnosÚstr)r2ÚerrÚurlÚ
timeout_valuer3r3r4Ú_raise_timeoutPs
z!HTTPConnectionPool._raise_timeoutc
HKsn|jd7_|j|ƒ}|jƒ|j|_y|j|ƒWn:ttfk
rp}z|j|||jd‚WYdd}~XnXy*|rŠ|j	||f|Žn|j
||f|ŽWnLtk
r°Yn:tk
rè}z|j
t
jt
jt
jhkr؂WYdd}~XnX|j}	t|ddƒrB|	dkrt||d|	ƒ‚|	tjkr6|jjtjƒƒn|jj|	ƒyjy|jdd}
WnTtk
r¨y|jƒ}
Wn0tk
r¢}ztj|dƒWYdd}~XnXYnXWn<tttfk
rè}z|j|||	d‚WYdd}~XnXt|d	d
ƒ}t j!d|j"|j#|j$||||
j%|
j&ƒ	yt'|
j(ƒWn@t)tfk
rh}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)rvrwrxNÚsockrz!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),rSrpÚ
start_connectr_rrlrrrryÚrequest_chunkedÚrequestrÚIOErrorrqÚEPIPEZ	ESHUTDOWNZ
EPROTOTYPEÚread_timeoutrfrr&ÚDEFAULT_TIMEOUTrzÚ
settimeoutÚsocketÚgetdefaulttimeoutÚgetresponseÚ	TypeErrorÚ
BaseExceptionrÚ
raise_fromÚSocketErrorr\r]r-r.r1ÚstatusÚlengthr#ÚmsgrriÚ
_absolute_url)
r2r`ÚmethodrwrÚchunkedÚhttplib_request_kwÚtimeout_objÚerƒÚhttplib_responseÚhttp_versionÚhper3r3r4Ú
_make_requestisx


(z HTTPConnectionPool._make_requestcCst|j|j|j|djS)N)r-r.r1Úpath)r'r-r.r1rw)r2ršr3r3r4ràsz HTTPConnectionPool._absolute_urlcCsZ|jdkrdS|jd}|_y"x|jdd}|r |jƒq WWntjk
rTYnXdS)zD
        Close all pooled connections and disable the pool.
        NF)rN)rMrcr:rre)r2Úold_poolr`r3r3r4r:ãs
zHTTPConnectionPool.closecCs||jdƒrdSt|ƒ\}}}|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)r1r
rcr-r.)r2rwr-r.r1r3r3r4Úis_same_hostõs
zHTTPConnectionPool.is_same_hostTc
/Ksdt|ƒ}|j}|dkr|j}t|tƒs8tj|||jd}|
dkrL|
jddƒ}
|rh|j|ƒrht	|||ƒ‚|j
dƒr‚tjt
|ƒƒ}ntj|jƒ}d}|
}t|j|j|ƒ}|s¾|jƒ}|j|jƒd}d}t||ƒ}zÊy¢|j|ƒ}|j|	d}|j|_|jdk	ot|ddƒ}|r$|r$|j|ƒ|j|||||||d	}|
sF|nd}||
d
<|jj|f|||dœ|
—Ž}d}Wn"tk
r˜d}d}‚Ynt t!t"t#t$t%t&fk
r˜}zÖd}dd
„}t|t$ƒr|jr||ƒr|jr|jjdkrt'dt%|ƒƒ}nXt|t$t&fƒr"t%|ƒ}n>t|t"t(fƒrF|jrFt'd|ƒ}nt|t"t!fƒr`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¶|j3dkr,d}y|j)||||d}Wn(t4k
rj|j5rf|j6ƒ‚|SX|j6ƒ|j7|ƒt/j8d||ƒ|j1||||f|||||	|
||dœ|
—ŽSt9|jjdƒƒ}|j:||j3|ƒr`y|j)||||d}Wn(t4k
r|j;r|j6ƒ‚|SX|j6ƒ|j,|ƒt/j8d|ƒ|j1||||f|||||	|
||dœ|
—ŽS|S)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)ÚredirectÚdefaultÚpreload_contentTrœF)rrz)rÚbodyrWr’Úrequest_method)rMÚ
connectionrLcSs*djtjdt|ƒjƒƒƒ}d|kp(d|kS)Nú z[^a-z]zwrong version numberzunknown protocol)ÚjoinÚreÚsplitrur/)Z	ssl_errorÚmessager3r3r4Ú%_is_ssl_error_message_from_http_proxyñszIHTTPConnectionPool.urlopen.<locals>._is_ssl_error_message_from_http_proxyÚhttpsz¹Your 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_connr’Úbody_posi/ÚGET)Úresponser­zRedirecting %s -> %s)rLrŸÚassert_same_hostrr¯r°r’r±zRetry-Afterz	Retry: %s)<r+r-rWrIr$Úfrom_intrLrcržrrrZ
ensure_strr(rwr rFrGÚcopyÚupdaterOr"rprgr_rrfrmr™ÚResponseClsÚfrom_httplibrrr
rŒrrrr%rrÚ	incrementÚsysr}Úsleepr:rkr\riÚurlopenÚget_redirect_locationrrÚraise_on_redirectZ
drain_connÚsleep_for_retryr]ÚboolÚis_retryÚraise_on_status)r2r‘rwr¢rWrLrŸr´rr¯r°r’r±Úresponse_kwÚ
parsed_urlZdestination_schemer`Úrelease_this_connZhttp_tunnel_requiredrvÚ
clean_exitr”Úis_new_proxy_connr–Ú
response_connr³r•rªÚredirect_locationÚhas_retry_afterr3r3r4r½
s:m










zHTTPConnectionPool.urlopen)N)r7r?r@rAr-r	r^rr¸r&r„r5rargrkrlrmrpryrnr™rr:ržr½r3r3r3r4rCisF:*
'vrCcspeZdZdZdZeZddejdddddddddddddddfdd„Z	dd	„Z
d
d„Zdd
„Z‡fdd„Z
‡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.
    r«NFrcKs\tj||||||||||	|
f|Ž||_||_|
|_||_||_||_||_||_	||_
dS)N)rCr5Úkey_fileÚ	cert_fileÚ	cert_reqsÚkey_passwordÚca_certsÚca_cert_dirÚssl_versionÚassert_hostnameÚassert_fingerprint)r2r.r1rHrrVrNrWrLrXrYrÍrÎrÏrÐrÑrÓrÔrÕrÒrTr3r3r4r5’s,zHTTPSConnectionPool.__init__c
Cs@t|tƒr<|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.
        )rÍrÐrÎrÏrÑrÒrÔrÕ)rIrÚset_certrÍrÐrÎrÏrÑrÒrÔrÕrÓ)r2r`r3r3r4Ú
_prepare_connÃs

z!HTTPSConnectionPool._prepare_conncCs2|j|j|j|jƒ|jjdkr&d|_|jƒdS)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.
        r«TN)Ú
set_tunnelr0r1rOrFr-Ztls_in_tls_requiredÚconnect)r2r`r3r3r4rm×s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:%sZ443zCCan't connect to HTTPS URL because the SSL module is not available.N)r.r1rrHrÎrÍrÐ)rRr\r]r.r1r^rrrFrr_rHrÎrÍrÐrTr×)r2Úactual_hostÚactual_portr`r3r3r4raæs0

zHTTPSConnectionPool._new_conncs\tt|ƒj|ƒt|ddƒs$|jƒ|js<tjd|jt	ƒt|ddƒdkrXtjdt	ƒdS)zU
        Called right before a request is made, after the socket is created.
        rzNz¸Unverified 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-warningsZproxy_is_verifiedFz·Unverified 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)
ÚsuperrÌrlrfrÙÚis_verifiedÚwarningsÚwarnr.r)r2r`)Ú	__class__r3r4rl
sz"HTTPSConnectionPool._validate_conn)r7r?r@rAr-rr^r&r„r5r×rmrarlÚ
__classcell__r3r3)ràr4ŕs2$rÌcKsRt|ƒ\}}}|ptj|dƒ}|dkr:t|fd|i|—ŽSt|fd|i|—ŽSdS)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', '/')
    éPr«r1N)r*r
rcrÌrC)rwÚkwr-r.r1r3r3r4Úconnection_from_url+s
räcCs.t||ƒ}|jdƒr*|jdƒr*|dd…}|S)z?
    Normalize hosts for comparisons and use with sockets.
    ú[ú]réÿÿÿÿ)Únormalize_hostrÚendswith)r.r-r3r3r4r)Gs
r))PÚ
__future__rrqÚloggingr§r†r»rÞrrŒrrrr¤rrrr	r
rrr
Ú
exceptionsrrrrrrrrrrrrrÚpackagesrZpackages.six.movesrr€rr³rZutil.connectionrZ
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)rèr*r+ÚmovesrPÚ	getLoggerr7r\Úobjectrnr,ÚEAGAINÚEWOULDBLOCKrtrCrÌrär3r3r3r4Ú<module>sR(
<
)+