Uname: Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Software: LiteSpeed
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.213.251.212
Your Ip: 3.135.201.139
User: allssztx (535) | Group: allssztx (533)
Safe Mode: OFF
Disable Function:
NONE

name : request.cpython-313.pyc
�

+}g������SrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSK
r
SSKrSSKrSSKrSSKJrJrJr SSKJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r' SSK(J)r)J*r* SSK+r+Sr,/SQr.S	\R^SS
-r0Sq1S\
Rd4SS.Sjjr3S
r4/r5SgSjr6Sr7\	Rp"S\	Rr5r:Sr;"SS5r<"SS5r=Sr>"SS5r?"SS\?5r@"SS\?5rA"SS\?5rBSrC"S S!\?5rD"S"S#5rE"S$S%\E5rF"S&S'\F5rG"S(S)5rH"S*S+\H\?5rI"S,S-\H\?5rJ\R�rL"S.S/5rM"S0S1\?\M5rN"S2S3\?\M5rO"S4S5\?5rP"S6S7\P5rQ\R"\R�S85(a"S9S:\P5rT\.R�S:5 "S;S<\?5rV"S=S>\?5rWS?rXS@rY"SASB\?5rZSCr["SDSE\?5r\"SFSG\\5r]"SHSI\?5r^SJr_\R�SK:Xa	SSLKaJbrbJcrc OSMrbSNrc0rd"SOSP5re"SQSR\e5rfSqgSSrhSqiSTrjSqkSUrlSqmSVrn"SWSX5roSYrpShSZjrqS[rrS\rs\R�S]:XaSS^KuJvrvJwrw S_rxS`rySarzSbr{g\R�SK:Xa
Scr|Sdr{Ser}Sfrzg\pr{\qrzg!\-a Sr,GNef=f)ia�
An extensible library for opening URLs using a variety of protocols

The simplest way to use this module is to call the urlopen function,
which accepts a string containing a URL or a Request object (described
below).  It opens the URL and returns the results as file-like
object; the returned object has some extra methods described below.

The OpenerDirector manages a collection of Handler objects that do
all the actual work.  Each Handler implements a particular protocol or
option.  The OpenerDirector is a composite object that invokes the
Handlers needed to open the requested URL.  For example, the
HTTPHandler performs HTTP GET and POST requests and deals with
non-error returns.  The HTTPRedirectHandler automatically deals with
HTTP 301, 302, 303, 307, and 308 redirect errors, and the
HTTPDigestAuthHandler deals with digest authentication.

urlopen(url, data=None) -- Basic usage is the same as original
urllib.  pass the url and optionally data to post to an HTTP URL, and
get a file-like object back.  One difference is that you can also pass
a Request instance instead of URL.  Raises a URLError (subclass of
OSError); for HTTP errors, raises an HTTPError, which can also be
treated as a valid response.

build_opener -- Function that creates a new OpenerDirector instance.
Will install the default handlers.  Accepts one or more Handlers as
arguments, either instances or Handler classes that it will
instantiate.  If one of the argument is a subclass of the default
handler, the argument will be installed instead of the default.

install_opener -- Installs a new opener as the default opener.

objects of interest:

OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
the Handler classes, while dealing with requests and responses.

Request -- An object that encapsulates the state of a request.  The
state can be as simple as the URL.  It can also include extra HTTP
headers, e.g. a User-Agent.

BaseHandler --

internals:
BaseHandler and parent
_call_chain conventions

Example usage:

import urllib.request

# set up authentication info
authinfo = urllib.request.HTTPBasicAuthHandler()
authinfo.add_password(realm='PDQ Application',
                      uri='https://mahler:8092/site-updates.py',
                      user='klem',
                      passwd='geheim$parole')

proxy_support = urllib.request.ProxyHandler({"http" : "http://ahad-haam:3128"})

# build a new opener that adds authentication and caching FTP handlers
opener = urllib.request.build_opener(proxy_support, authinfo,
                                     urllib.request.CacheFTPHandler)

# install it
urllib.request.install_opener(opener)

f = urllib.request.urlopen('https://www.python.org/')
�N)�URLError�	HTTPError�ContentTooShortError)�urlparse�urlsplit�urljoin�unwrap�quote�unquote�
_splittype�
_splithost�
_splitport�
_splituser�_splitpasswd�
_splitattr�_splitquery�_splitvalue�	_splittag�	_to_bytes�unquote_to_bytes�
urlunparse)�
addinfourl�addclosehookTF)!�Request�OpenerDirector�BaseHandler�HTTPDefaultErrorHandler�HTTPRedirectHandler�HTTPCookieProcessor�ProxyHandler�HTTPPasswordMgr�HTTPPasswordMgrWithDefaultRealm�HTTPPasswordMgrWithPriorAuth�AbstractBasicAuthHandler�HTTPBasicAuthHandler�ProxyBasicAuthHandler�AbstractDigestAuthHandler�HTTPDigestAuthHandler�ProxyDigestAuthHandler�HTTPHandler�FileHandler�
FTPHandler�CacheFTPHandler�DataHandler�UnknownHandler�HTTPErrorProcessor�urlopen�install_opener�build_opener�pathname2url�url2pathname�
getproxies�urlretrieve�
urlcleanup�	URLopener�FancyURLopenerz%d.%d���contextc��U(a[US9n[U5nO[c
[5=qnO[nURXU5$)a�Open the URL url, which can be either a string or a Request object.

*data* must be an object specifying additional data to be sent to
the server, or None if no such data is needed.  See Request for
details.

urllib.request module uses HTTP/1.1 and includes a "Connection:close"
header in its HTTP requests.

The optional *timeout* parameter specifies a timeout in seconds for
blocking operations like the connection attempt (if not specified, the
global default timeout setting will be used). This only works for HTTP,
HTTPS and FTP connections.

If *context* is specified, it must be a ssl.SSLContext instance describing
the various SSL options. See HTTPSConnection for more details.


This function always returns an object which can work as a
context manager and has the properties url, headers, and status.
See urllib.response.addinfourl for more detail on these properties.

For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse
object slightly modified. In addition to the three new methods above, the
msg attribute contains the same information as the reason attribute ---
the reason phrase returned by the server --- instead of the response
headers as it is specified in the documentation for HTTPResponse.

For FTP, file, and data URLs and requests explicitly handled by legacy
URLopener and FancyURLopener classes, this function returns a
urllib.response.addinfourl object.

Note that None may be returned if no handler handles the request (though
the default installed global OpenerDirector uses UnknownHandler to ensure
this never happens).

In addition, if proxy settings are detected (for example, when a *_proxy
environment variable like http_proxy is set), ProxyHandler is default
installed and makes sure the requests are handled through the proxy.

r<)�HTTPSHandlerr3�_opener�open)�url�data�timeoutr=�
https_handler�openers      �5/opt/alt/python313/lib64/python3.13/urllib/request.pyr1r1�sC��X�$�W�5�
��m�,��	��'�>�)��&����;�;�s�'�*�*�c��Uqg�N)r@)rFs rGr2r2�s���GrHc�L�[U5upE[R"[X55nUR	5nUS:Xa1U(d*[
RRU5U4sSSS5 $U(a
[US5nO5[R"SS9nURn[RU5 U X4n	Sn
SnSnSn
S	U;a[US
5nU(a	U"X�U5 URU
5=n(aNU[!U5-
nUR#U5 U
S-
n
U(a	U"X�U5 URU
5=n(aMNSSS5 SSS5 WS:�aWU:a[%SX�4-W	5eW	$!,(df   N4=f!,(df   N==f)
a+
Retrieve a URL into a temporary location on disk.

Requires a URL argument. If a filename is passed, it is used as
the temporary file location. The reporthook argument should be
a callable that accepts a block number, a read size, and the
total file size of the URL target. The data argument should be
valid URL encoded data.

If a filename is passed and the URL points to a local resource,
the result is a copy from local file to new file.

Returns a tuple containing the path to the newly created
data file as well as the resulting HTTPMessage object.
�fileN�wbF)�delete� ���r�content-length�Content-Length��1retrieval incomplete: got only %i out of %i bytes)r�
contextlib�closingr1�info�os�path�normpathrA�tempfile�NamedTemporaryFile�name�_url_tempfiles�append�int�read�len�writer)rB�filename�
reporthookrC�url_typerY�fp�headers�tfp�result�bs�sizera�blocknum�blocks               rGr7r7�s}��  ��_�N�H�	�	�	�G�C�.�	/�2��'�'�)���v��h��7�7�#�#�D�)�7�2�

0�	/���x��&�C��-�-�U�;�C��x�x�H��!�!�(�+�
��&�F��B��D��D��H��7�*��7�#3�4�5����8��.��7�7�2�;�&�%�&���E�
�"���	�	�%� ��A�
����x�T�2��7�7�2�;�&�%�&��!
0�F�q�y�T�D�[�"�?��l�
�"�$�	$��M�1�S��!
0�	/�s+�>F�5AF�BF�F�
F	�F�
F#c��[Hn[R"U5 M [SS2	[(aSqgg![a MCf=f)z0Clean up temporary files from urlretrieve calls.N)r^rX�unlink�OSErrorr@)�	temp_files rGr8r8sJ��#�	�	��I�I�i� �$�	�q���w������	��	�s�=�
A�
Az:\d+$c��URn[U5SnUS:XaURSS5n[R	SUS5nUR5$)z|Return request-host, as defined by RFC 2965.

Variation from RFC: returned value is lowercased, for convenient
comparison.

rS��Host)�full_urlr�
get_header�_cut_port_re�sub�lower)�requestrB�hosts   rG�request_hostr}sX���
�
�C��C�=���D��r�z��!�!�&�"�-�����B��a�(�D��:�:�<�rHc��\rSrSrS0SSS4Sjr\S5r\RS5r\RS5r\S5r	\	RS	5r	\	RS
5r	Sr
SrS
rSr
SrSrSrSrSSjrSrSrSrg)riNFc��Xl0Ul0UlSUlX lSUlUR
5HupxURXx5 M Uc[U5nX@l	XPl
U(aX`lggrJ)rvrh�unredirected_hdrs�_datarC�_tunnel_host�items�
add_headerr}�origin_req_host�unverifiable�method)	�selfrBrCrhr�r�r��key�values	         rG�__init__�Request.__init__!ss���
����!#�����
��	� ���!�-�-�/�J�C��O�O�C�'�*��"�*�4�0�O�.��(��� �K�rHc��UR(a&SRURUR5$UR$)Nz{}#{})�fragment�format�	_full_url�r�s rGrv�Request.full_url3s,���=�=��>�>�$�.�.�$�-�-�@�@��~�~�rHc��[U5Ul[UR5uUlUlUR	5 grJ)r	r�rr��_parse�r�rBs  rGrvr�9s/�� �����(1�$�.�.�(A�%����
����
rHc�.�SUlSUlSUlg)Nrt)r�r��selectorr�s rGrvr�@s�������
���
rHc��UR$rJ)r�r�s rGrC�Request.dataFs���z�z�rHc��XR:wa/XlURS5(aURS5 ggg)N�Content-length)r��
has_header�
remove_header)r�rCs  rGrCr�Js<���:�:���J����/�0�0��"�"�#3�4�1�rHc��SUlgrJ)rCr�s rGrCr�Ts	����	rHc��[UR5uUlnURc[SUR-5e[U5uUlUlUR(a[UR5Ulgg)Nzunknown url type: %r)	rr��type�
ValueErrorrvr
r|r�r)r��rests  rGr��Request._parseXsd��$�T�^�^�4���	�4��9�9���3�d�m�m�C�D�D�#-�d�#3� ��	�4�=��9�9���	�	�*�D�I�rHc�>�URbSOSn[USU5$)z3Return a string indicating the HTTP request method.�POST�GETr�)rC�getattr)r��default_methods  rG�
get_method�Request.get_method`s!��#'�9�9�#8��e���t�X�~�6�6rHc��UR$rJ)rvr�s rG�get_full_url�Request.get_full_urles���}�}�rHc��URS:Xa#UR(dURUlOX lURUlXlg)N�https)r�r�r|rvr�)r�r|r�s   rG�	set_proxy�Request.set_proxyhs7���9�9����(9�(9� $�	�	�D���I� �M�M�D�M��	rHc�4�URUR:H$rJ)r�rvr�s rG�	has_proxy�Request.has_proxyps���}�}��
�
�-�-rHc�<�X RUR5'grJ)rh�
capitalize�r�r��vals   rGr��Request.add_headerss��),���S�^�^�%�&rHc�<�X RUR5'grJ)r�r�r�s   rG�add_unredirected_header�Request.add_unredirected_headerws��36���s�~�~�/�0rHc�H�XR;=(d XR;$rJ)rhr��r��header_names  rGr��Request.has_header{s"���|�|�+�6��5�5�5�	7rHc�l�URRUURRX55$rJ)rh�getr�)r�r��defaults   rGrw�Request.get_headers0���|�|�����"�"�&�&�{�<�>�	>rHc�t�URRUS5 URRUS5 grJ)rh�popr�r�s  rGr��Request.remove_header�s,��������d�+����"�"�;��5rHc�h�0UREUREn[UR55$rJ)r�rh�listr�)r��hdrss  rG�header_items�Request.header_items�s,��9�$�(�(�9�D�L�L�9���D�J�J�L�!�!rH)r�r�r�rCr�rvrhr|r�r�r�r�r�r�rJ)�__name__�
__module__�__qualname__�__firstlineno__r��propertyrv�setter�deleterrCr�r�r�r�r�r�r�r�rwr�r��__static_attributes__�rHrGrrs���!%�r�!%�E��!�$����
�_�_����������
����
�[�[�5��5�
�\�\����+�7�
��.�-�7�7�>�
6�"rHrc�^�\rSrSrSrSrSrSrS\R4Sjr
SSjrS	rS
r
g)ri�c�p�S[-nSU4/Ul/Ul0Ul0Ul0Ul0Ulg)N�Python-urllib/%sz
User-agent)�__version__�
addheaders�handlers�handle_open�handle_error�process_response�process_request)r��client_versions  rGr��OpenerDirector.__init__�sB��+�k�9��(�.�9�:�����
������� "���!��rHc�<�[US5(d[S[U5-5eSn[U5GHnUS;aMUR	S5nUSUnX4S-SnURS5(aUUR	S5U-S-nX7S-Sn[
U5nURRU05n	X�RU'OAUS:XaUnURn	O,US	:XaUnURn	OUS
:XaUnURn	OM�U	RU/5n
U
(a[R"X�5 OU
R!U5 SnGM U(a3[R"UR"U5 UR%U5 gg![a N�f=f)N�
add_parentz%expected BaseHandler instance, got %rF)�redirect_request�do_open�
proxy_open�_rS�errorrA�responser{T)�hasattr�	TypeErrorr��dir�find�
startswithr`r�r�r�r�r�r��
setdefault�bisect�insortr_r�r�)r��handler�added�meth�i�protocol�	condition�j�kind�lookupr�s           rG�add_handler�OpenerDirector.add_handler�s����w��-�-��C� ��M�*�+�
+�����L�D��D�D���	�	�#��A��B�Q�x�H��q�S�T�
�I��#�#�G�,�,��N�N�3�'�!�+�a�/���a�C�D�z����t�9�D��*�*�.�.�x��<��.4�!�!�(�+��f�$����)�)���j�(����.�.���i�'����-�-����(�(��r�2�H���
�
�h�0�����(��E�G!�J��M�M�$�-�-��1����t�$���/"����s�F�
F�Fc��grJr�r�s rG�close�OpenerDirector.close����rHc�h�URUS5nUHn[Xc5nU"U6nUcMUs $ g)Nr�)r�r�)	r��chainr��	meth_name�argsr�r��funcrjs	         rG�_call_chain�OpenerDirector._call_chain�s<���9�9�T�2�&���G��7�.�D��4�[�F��!��
�	 rHNc��[U[5(a[X5nOUnUbX$lX4lUR
nUS-nURRU/5Hn[Xv5nU"U5nM [R"SURURURUR55 URXB5n	US-nURRU/5Hn[Xv5nU"XI5n	M U	$)N�_requestzurllib.Request�	_response)�
isinstance�strrrCrDr�r�r�r��sys�auditrvrhr��_openr�)
r��fullurlrCrD�reqr�r�	processorr�r�s
          rGrA�OpenerDirector.open�s����g�s�#�#��'�(�C��C��������8�8���Z�'�	��-�-�1�1�(�B�?�I��9�0�D��s�)�C�@�	�	�	�"�C�L�L�#�(�(�C�K�K����IY�Z��:�:�c�(���[�(�	��.�.�2�2�8�R�@�I��9�0�D��C�*�H�A��rHc��URURSSU5nU(aU$URnURURXDS-U5nU(aU$URURSSU5$)Nr��default_openr�unknown�unknown_open)rr�r�)r�rrCrjr�s     rGr�OpenerDirector._open�s����!�!�$�"2�"2�I�"0�#�7����M��8�8���!�!�$�"2�"2�H�")�?*�+.�0����M����� 0� 0�)� .��5�	5rHc���US;aURSnUSnSU-nSnUnOURnUS-nSnX1U4U-nUR"U6nU(aU$U(aUSS	4W-nUR"U6$g)
N��httpr�rr;z
http_error_%srS�_errorrr��http_error_default)r�r)r��protor�dictr�http_err�	orig_argsrjs        rGr��OpenerDirector.errors����%�%��$�$�V�,�D���G�E�'�%�/�I��H��I��$�$�D���(�I��H��Y�'�$�.���!�!�4�(����M���)�%9�:�Y�F�D��#�#�T�*�*�rH)r�r�r�r�r�r�rJ)r�r�r�r�r�r�r�r�socket�_GLOBAL_DEFAULT_TIMEOUTrArr�r�r�rHrGrr�s3��	"�-%�^
�	�"&�v�/M�/M��:
5�+rHrc	��[5n[[[[[
[[[[/	n[[RS5(aUR[5 [5nUHinUH`n[!U["5(a%[%XT5(aUR'U5 M;M=[!XT5(dMOUR'U5 Mb Mk UHnUR)U5 M UHnUR+U"55 M UH0n[!U["5(aU"5nUR+U5 M2 U$)aCreate an opener object from a list of handlers.

The opener will use several default handlers, including support
for HTTP, FTP and when applicable HTTPS.

If any of the handlers passed as arguments are subclasses of the
default handlers, the default handlers will not be used.
�HTTPSConnection)rr r/r*rrr,r+r0r.r�r�clientr_r?�setrr��
issubclass�add�remover�)r�rF�default_classes�skip�klass�check�hs       rGr3r3s���
�F�#�^�[�.�0C�!�;�0B�"�$�O��t�{�{�-�.�.����|�,��5�D� ���E��%��&�&��e�+�+��H�H�U�O�,��E�)�)�������!������u�%��!�����5�7�#�!����a������A����1����MrHc�*�\rSrSrSrSrSrSrSrg)ri?��c��XlgrJ��parent)r�r5s  rGr��BaseHandler.add_parentBs���rHc��grJr�r�s rGr��BaseHandler.closeErrHc�X�[US5(dgURUR:$)N�
handler_orderT)r�r:)r��others  rG�__lt__�BaseHandler.__lt__Is+���u�o�.�.���!�!�E�$7�$7�7�7rHr4N)	r�r�r�r�r:r�r�r<r�r�rHrGrr?s���M��
�8rHrc�&�\rSrSrSrSrSr\rSrg)r0iRzProcess HTTP error responses.i�c��URURUR5pTnSUs=::aS:d O URR	SXX4U5nU$)N���,r)�code�msgrWr5r�)r�r{r�rBrCr�s      rG�
http_response� HTTPErrorProcessor.http_responseVsN��"�-�-����x�}�}��4���t�!�c�!��{�{�(�(���4�d�<�H��rHr�N)	r�r�r�r��__doc__r:rD�https_responser�r�rHrGr0r0Rs��'��M�	�#�NrHr0c��\rSrSrSrSrg)ricc�0�[URX4XR5erJ)rrv)r�rrgrBrCr�s      rGr�*HTTPDefaultErrorHandler.http_error_defaultds������d��:�:rHr�N)r�r�r�r�rr�r�rHrGrrcs��;rHrc�<�\rSrSrSrSrSrSr\=r=r	=r
rSrSr
g)	rig��
c�z�UR5nUS;aUS;d#US;aUS:Xd[URX4XR5eURSS5nSnURR5V	V
s0sHup�U	R
5U;dMX�_M nn	n
[UUS:XaSOS	UURS
S9$s sn
n	f)auReturn a Request or None in response to a redirect.

This is called by the http_error_30x methods when a
redirection response is received.  If a redirection should
take place, return a new Request to allow http_error_30x to
perform the redirect.  Otherwise, raise HTTPError if no-one
else should try to handle this url.  Return None if you can't
but another Handler might.
)�-�.�/i3i4)r��HEAD)rOrPrQr�� z%20)rQzcontent-typerRr�T)r�rhr�r�)	r�rrv�replacerhr�rzrr�)r�rrgrBrCrh�newurl�m�CONTENT_HEADERS�k�v�
newheaderss            rGr��$HTTPRedirectHandler.redirect_requestos���
�N�N����2�2�q�O�7K���&�1��;��C�L�L�$�W�A�A�����U�+��<��'*�{�{�'8�'8�':�;�':�t�q�����/�9��a�d�':�
�;��v�()�V��f��)�'*�':�':�$(�	*�	*��;s�1B7�B7c�r�SU;aUSnO
SU;aUSnOg[U5nURS;a[XcU<SU<S3XR5eUR(d!UR(a[U5nSUS'[
U5n[US[RS	9n[URU5nURXX4XV5nUcg[US
5(aqUR=o�lU	RUS5UR :�d[#U	5UR$:�a%[URUUR&U-XR5eO0=n	=UlUlU	RUS5S-X�'UR)5 UR+5 UR,R/X�R0S
9$)N�location�uri�rr��ftprtz - Redirection to url 'z' is not allowed�/r;z
iso-8859-1)�encoding�safe�
redirect_dictrrS�rD)r�schemerrY�netlocr�rr
�string�punctuationrrvr�r�rdr��max_repeatsrb�max_redirections�inf_msgrar�r5rArD)
r�rrgrBrCrhrU�urlparts�new�visiteds
          rG�http_error_302�"HTTPRedirectHandler.http_error_302�s����� ��Z�(�F�
�g�
��U�^�F���F�#��
�?�?�">�>���AD�f�M���
�
�}�}�����H�~�H��H�Q�K��H�%��
��\��0B�0B�D������v�.��
�#�#�C�T��H���;���3��(�(�*-�*;�*;�;�G�'����F�A�&�$�*:�*:�:��G��� 5� 5�5�����d� $���s� 2�G�A�A�6�?A�@�G�@�c�'�#�*;�!�+�+�f�a�0�1�4���	���	�
���
��{�{����[�[��9�9rHzoThe HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
r�N)r�r�r�r�rjrkr�rp�http_error_301�http_error_303�http_error_307�http_error_308rlr�r�rHrGrrgs<���K���!*�N::�xIW�V�N�V�^�V�n�~�2�GrHrc�v�[U5upURS5(dSnUnOmURS5(d[SU-5eSU;a$URS5nURSU5nOURSS5nUS:XaSnUSUn[	U5upgUb[U5up�OS=p�XX�4$)z�Return (scheme, user, password, host/port) given a URL or an authority.

If a URL is supplied, it must have an authority (host:port) component.
According to RFC 3986, having an authority component means the URL must
have two slashes after the scheme.
raN�//zproxy URL with no authority: %r�@r;rP)rr�r�r�rr)
�proxyrf�r_scheme�	authority�host_separator�end�userinfo�hostport�user�passwords
          rG�_parse_proxyr��s���"�%�(��F����s�#�#����	��"�"�4�(�(��>��F�G�G��(�?�%�]�]�3�/�N��-�-��^�4�C��-�-��Q�'�C��"�9��C��Q�s�O�	�#�I�.��H���%�h�/���h������+�+rHc�(�\rSrSrSrSSjrSrSrg)r i��dNc���Uc
[5n[US5(dS5eXlUR5H4up#UR	5n[USU-X2UR4Sj5 M6 g)N�keys�proxies must be a mappingz%s_openc��U"XU5$rJr�)�rryr�r�s    rG�<lambda>�'ProxyHandler.__init__.<locals>.<lambda>s���Q�t�,rH)r6r��proxiesr�rz�setattrr�)r�r�r�rBs    rGr��ProxyHandler.__init__�sh���?� �l�G��w��'�'�D�)D�D�'��� ����I�D��:�:�<�D��D�)�d�*�$'����-�
.�)rHc��URn[U5upVpxUcUnUR(a[UR5(agU(ajU(ac[	U5<S[	U5<3n	[
R"U	R55RS5n
URSSU
-5 [	U5nURX�5 XE:XdUS:XagURRXRS9$)N�:�ascii�Proxy-authorization�Basic r�re)r�r�r|�proxy_bypassr�base64�	b64encode�encode�decoder�r�r5rArD)r�rryr��	orig_type�
proxy_typer�r�r�	user_pass�credss           rGr��ProxyHandler.proxy_open	s����H�H�	�/;�E�/B�,�
�(���"�J��8�8��S�X�X�.�.���H�#*�4�=�#*�8�#4�6�I��$�$�Y�%5�%5�%7�8�?�?��H�E��N�N�0�(�U�2B�C��8�$���
�
�h�+��"�i�7�&:���;�;�#�#�C���#�=�=rH)r�rJ)r�r�r�r�r:r�r�r�r�rHrGr r �s���M�	.�>rHr c�6�\rSrSrSrSrSrS	SjrSrSr	g)
r!i%c��0UlgrJ��passwdr�s rGr��HTTPPasswordMgr.__init__'s	����rHc��^^�[U[5(aU/nUTR;a0TRU'SH,m[UU4SjU55nX44TRUU'M. g)N�TFc3�H># �UHnTRUT5v� M g7frJ)�
reduce_uri)�.0�u�default_portr�s  ��rG�	<genexpr>�/HTTPPasswordMgr.add_password.<locals>.<genexpr>1s"���� ?�:=�Q�����<�0�0�#�s�")rrr��tuple)r��realmr^r�r��reduced_urir�s`     @rG�add_password�HTTPPasswordMgr.add_password*sg����c�3����%�C�����#�!#�D�K�K���'�L�� ?�:=� ?�?�K�/3�n�D�K�K���{�+�(rHc���URRU05nSHTnURX$5nUR5H,upgUH!nUR	X�5(dMUs s s $ M. MV g)Nr��NN)r�r�r�r��	is_suburi)	r�r��authuri�domainsr��reduced_authuri�uris�authinfor^s	         rG�find_user_password�"HTTPPasswordMgr.find_user_password5sc���+�+�/�/�%��,��'�L�"�o�o�g�D�O�")�-�-�/����C��~�~�c�;�;�'�� �#2�(�rHc���[U5nUS(aUSnUSnUS=(d SnOSnUnSn[U5upxU(a#Uc UbSSS.RU5n	U	bS	Xy4-nXV4$)
z@Accept authority or URI and extract only the authority and path.rSrr;raN�Pi�rz%s:%d)rrr�)
r�r^r��partsrfr{rYr|�port�dports
          rGr��HTTPPasswordMgr.reduce_uri?s�����
����8��1�X�F��a��I���8�?�s�D��F��I��D��	�*�
���D�L�V�-?��!���s�6�{�
�� �#�t�m�3�	���rHc�v�X:XagUSUS:wagUSnUSSS:waUS-
nUSRU5$)zSCheck if test is below base in a URI tree

Both args must be URIs in reduced form.
TrFrSrPNra)r�)r��base�test�prefixs    rGr��HTTPPasswordMgr.is_suburiVsT��
�<����7�d�1�g����a����"�#�;�#���c�M�F��A�w�!�!�&�)�)rHr�N)T)
r�r�r�r�r�r�r�r�r�r�r�rHrGr!r!%s���	=���.*rHr!c��\rSrSrSrSrg)r"iec�l�[RXU5up4UbX44$[RUSU5$rJ)r!r�)r�r�r�r�r�s     rGr��2HTTPPasswordMgrWithDefaultRealm.find_user_passwordgs=��(�;�;�D�<C�E������>�!��1�1�$��g�F�FrHr�N)r�r�r�r�r�r�r�rHrGr"r"es��GrHr"c�H^�\rSrSrU4SjrSU4SjjrSSjrSrSrU=r	$)r#ioc�4>�0Ul[TU]"U0UD6 grJ)�
authenticated�superr�)r�r�kwargs�	__class__s   �rGr��%HTTPPasswordMgrWithPriorAuth.__init__qs������
���$�)�&�)rHc�p>�URX%5 Ub[TU]	SX#U5 [TU]	XX45 grJ)�update_authenticatedr�r�)r�r�r^r�r��is_authenticatedr�s      �rGr��)HTTPPasswordMgrWithPriorAuth.add_passwordus7����!�!�#�8����G� ��s�&�9�
���U��6rHc��[U[5(aU/nSH+nUH"nURXC5nX RU'M$ M- g�Nr�)rrr�r�)r�r^r�r�r�r�s      rGr��1HTTPPasswordMgrWithPriorAuth.update_authenticated|sF���c�3����%�C�'�L���"�o�o�a�>��2B�"�"�;�/��(rHc��SHPnURX5nURH,nURXC5(dMURUs s $ MR gr�)r�r�r�)r�r�r�r�r^s     rGr��-HTTPPasswordMgrWithPriorAuth.is_authenticated�sJ��'�L�"�o�o�g�D�O��)�)���>�>�#�7�7��-�-�c�2�2�*�(rH)r�)F)
r�r�r�r�r�r�r�r�r��
__classcell__)r�s@rGr#r#os���*�7�C�3�3rHr#c�~�\rSrSr\R
"S\R5rSSjrSr	Sr
SrSrS	r
\r\
rS
rg)r$i�z1(?:^|,)[ 	]*([^ 	,]+)[ 	]+realm=(["']?)([^"']*)\2Nc�`�Uc
[5nXlURRUlgrJ)r!r�r�)r��password_mgrs  rGr��!AbstractBasicAuthHandler.__init__�s'����*�,�L�"�� �K�K�4�4��rHc#�*# �Sn[RRU5H?nUR5upEnUS;a[R
"S[S5 XF4v� SnMA U(d$U(aUR5SnOSnUS4v� gg7f)NF)�"�'zBasic Auth Realm was unquoted�Trrt)r$�rx�finditer�groups�warnings�warn�UserWarning�split)r��header�found_challenge�morfr
r�s       rG�_parse_realm�%AbstractBasicAuthHandler._parse_realm�s������*�-�-�6�6�v�>�B�#%�9�9�;� �F�5��J�&��
�
�=�)�1�.��/�!�"�O�?��������*�����4�.� ��s�BBc��URU5nU(dgSnUHNnURU5H6upxUR5S:waUnMUcM"URX#U5s s $ MP Ub[	SW<35eg)N�basicz@AbstractBasicAuthHandler does not support the following scheme: )�get_allr�rz�retry_http_basic_authr�)	r��authreqr|rrh�unsupportedr�rfr�s	         rG�http_error_auth_reqed�.AbstractBasicAuthHandler.http_error_auth_reqed�s����/�/�'�*�������F�!%�!2�!2�6�!:�
���<�<�>�W�,�"(�K���$� �5�5�d��G�G�";���"�� &�)�*�
*�#rHc��URRX15upEUb�U<SU<3nS[R"UR	55RS5-nUR
URS5U:XagURURU5 URRX"RS9$g)Nr�r�r�re)r�r�r�r�r�r�rw�auth_headerr�r5rArD)r�r|rr�r��pw�raw�auths        rGr��.AbstractBasicAuthHandler.retry_http_basic_auth�s����;�;�1�1�%�>���
�>�!�2�&�C��f�.�.�s�z�z�|�<�C�C�G�L�L�D��~�~�d�.�.��5��=���'�'��(8�(8�$�?��;�;�#�#�C���#�=�=�rHc���[URS5(a*URRUR5(dU$UR	S5(d�URRSUR5up#SR
X#5R5n[R"U5R5nURSSR
UR555 U$)Nr��
Authorizationz{0}:{1}zBasic {})
r�r�r�rvr�r�r�r�r��standard_b64encoder�r��strip)r�rr�r��credentials�auth_strs      rG�http_request�%AbstractBasicAuthHandler.http_request�s�������%7�8�8��{�{�+�+�C�L�L�9�9��J��~�~�o�.�.��;�;�9�9�$����M�L�D�#�*�*�4�8�?�?�A�K��0�0��=�D�D�F�H��'�'��(2�(9�(9�(�.�.�:J�(K�
M��
rHc��[URS5(ahSURs=::aS:a+O O(URRURS5 U$URRURS5 U$)Nr�r@rATF)r�r�rBr�rv)r�rr�s   rGrD�&AbstractBasicAuthHandler.http_response�sc���4�;�;� 2�3�3��h�m�m�)�c�)����0�0����t�D������0�0����u�E��rH)r�r�rJ)r�r�r�r��re�compile�Ir�r�r�r�r�rrD�
https_requestrGr�r�rHrGr$r$�sJ��
���1��D�D�
�B�5�!�(*�4
���!�M�"�NrHr$c��\rSrSrSrSrSrg)r%i�r�c�D�URnURSXaU5nU$)N�www-authenticate)rvr�)r�rrgrBrCrhrBr�s        rG�http_error_401�#HTTPBasicAuthHandler.http_error_401s(���l�l���-�-�.@�*-�G�=���rHr�N)r�r�r�r�r�r
r�r�rHrGr%r%�s��!�K�rHr%c��\rSrSrSrSrSrg)r&ir�c�D�URnURSXaU5nU$�N�proxy-authenticate)r|r�)r�rrgrBrCrhr{r�s        rG�http_error_407�$ProxyBasicAuthHandler.http_error_407s+��
�H�H�	��-�-�.B�*3�'�C���rHr�N)r�r�r�r�r�rr�r�rHrGr&r&s��'�K�rHr&c�H�\rSrSrSSjrSrSrSrSrSr	S	r
S
rSrg)
r'iNc��Uc
[5nXlURRUlSUlSUlSUlg�Nr)r!r�r��retried�nonce_count�
last_nonce)r�r�s  rGr��"AbstractDigestAuthHandler.__init__&s<���>�$�&�F��� �K�K�4�4�����������rHc��SUlgr)rr�s rG�reset_retry_count�+AbstractDigestAuthHandler.reset_retry_count/s	����rHc�h�URUS5nURS:�a[URSSUS5eU=RS-
slU(a[UR	5SnUR5S:XaUR
X55$UR5S:wa[SU-5egg)	N�i�zdigest auth failedrSr�digestr�zEAbstractDigestAuthHandler does not support the following scheme: '%s')r�rrrvr�rz�retry_http_digest_authr�)r�r�r|rrhr�rfs       rGr��/AbstractDigestAuthHandler.http_error_auth_reqed2s����+�+�k�4�0���<�<�!���C�L�L�#�/C�#�T�+�
+�
�L�L�A��L���]�]�_�Q�'�F��|�|�~��)��2�2�3�@�@�����7�*� �"?�AG�"H�I�I�+�	rHc�z�URSS5up4[[S[U555nUR	X5nU(aqSU-nUR
R
URS5U:XagURURU5 URRXRS9nU$g)NrSrSz	Digest %sre)r��parse_keqv_list�filter�parse_http_list�get_authorizationrhr�r�r�r5rArD)r�rr��token�	challenge�chal�auth_val�resps        rGr"�0AbstractDigestAuthHandler.retry_http_digest_authFs����:�:�c�1�-����v�d�O�I�,F�G�H���%�%�c�0���"�T�)�H��{�{���t�/�/��6�(�B���'�'��(8�(8�(�C��;�;�#�#�C���#�=�D��K�
rHc���UR<SU<S[R"5<S3nURS5[	S5-n[
R"U5R5nUSS$)Nr�r���)r�time�ctimer��_randombytes�hashlib�sha1�	hexdigest)r��nonce�s�b�digs     rG�
get_cnonce�$AbstractDigestAuthHandler.get_cnonceRsT�� �+�+�U�D�J�J�L�A��
�H�H�W���Q��/���l�l�1�o�'�'�)���3�B�x�rHc��USnUSnURS5nURSS5nURSS5nURU5up�UcgURR	X1R
5up�U
cgURbURURU5nOSnU
<SU<SU<3n
UR5<SUR<3nUcU	"U"U
5U<SU"U5<35nO�SURS	5;a}X@R:XaU=RS
-
slO
S
UlX@lSUR-nURU5nU<SU<SU<SS<SU"U5<3	nU	"U"U
5U5nO[SU-5eS
U
<SU<SU<SUR<SU<S3nU(aUSU--
nU(aUSU--
nUSU--
nU(aUSW<SW<S3-
nU$![a gf=f)Nr�r8�qop�	algorithm�MD5�opaquer�r��,rSz%08xzqop '%s' is not supported.z
username="z
", realm="z
", nonce="z", uri="z
", response="r�z
, opaque="%s"z
, digest="%s"z, algorithm="%s"z, qop=auth, nc=z
, cnonce=")r��KeyError�get_algorithm_implsr�r�rvrC�get_entity_digestr�r�r�rrr<r)r�rr+r�r8r?r@rB�H�KDr�r��entdig�A1�A2�respdig�ncvalue�cnonce�noncebitr�s                    rGr(�+AbstractDigestAuthHandler.get_authorization]s���		���M�E���M�E��(�(�5�/�C�����e�4�I��X�X�h��-�F��(�(��3����9���;�;�1�1�%���F����<���8�8���+�+�C�H�H�d�;�F��F����
+�����(����&��
�;���2��5�!�B�%� 8�9�G�
�s�y�y��~�
%����'�� � �A�%� �#$�� �"'���t�/�/�/�G��_�_�U�+�F�+0�'�6�6�1�R�5�Q�H���2���)�G��7�#�=�>�>��
#'��u�c�l�l�")�+����O�f�,�,�D���O�f�,�,�D��"�Y�.�.������H�H�D����g�	��	�s�?G;�;
H�Hc�\^�US:XaSmOUS:XaSmO[SU-5eU4SjnTU4$)NrAc�h�[R"URS55R5$�Nr�)r5�md5r�r7��xs rGr��?AbstractDigestAuthHandler.get_algorithm_impls.<locals>.<lambda>�s��'�+�+�a�h�h�w�&7�8�B�B�DrH�SHAc�h�[R"URS55R5$rS)r5r6r�r7rUs rGr�rW�s��'�,�,�q�x�x��'8�9�C�C�ErHz.Unsupported digest authentication algorithm %rc�">�T"U<SU<35$)Nr�r�)r9�drGs  �rGr�rW�s���!�q�!�,�-rH)r�)r�r@rHrGs   @rGrE�-AbstractDigestAuthHandler.get_algorithm_impls�sG������D�A�
�%�
�E�A��,�.7�8�9�
9�
-���"�u�rHc��grJr�)r�rCr+s   rGrF�+AbstractDigestAuthHandler.get_entity_digest�s��rH)r�rrr�rrJ)
r�r�r�r�r�rr�r"r<r(rErFr�r�rHrGr'r's,����I�(
�	�<�|�rHr'c�&�\rSrSrSrSrSrSrSrg)r(i�z�An authentication protocol defined by RFC 2069

Digest authentication improves on basic authentication because it
does not transmit passwords in the clear.
r���c�|�[UR5SnURSXaU5nUR5 U$)NrSr)rrvr�r�r�rrgrBrCrhr|�retrys        rGr
�$HTTPDigestAuthHandler.http_error_401�s>������%�a�(���*�*�+=�+/�g�?����� ��rHr�N)	r�r�r�r�rFr�r:r
r�r�rHrGr(r(�s���"�K��M�rHr(c�"�\rSrSrSrSrSrSrg)r)i��Proxy-Authorizationr`c�d�URnURSXaU5nUR5 U$r)r|r�rrbs        rGr�%ProxyDigestAuthHandler.http_error_407�s4���x�x���*�*�+?�+/�g�?����� ��rHr�N)r�r�r�r�r�r:rr�r�rHrGr)r)�s��'�K��M�rHr)c�6�\rSrSrS	SjrSrSrSrSrSr	g)
�AbstractHTTPHandleri�Nc�j�UbXlg[RRRUlgrJ)rr'�HTTPConnection�
debuglevel�_debuglevel)r�rms  rGr��AbstractHTTPHandler.__init__�s$��)3�)?�:��T�[�[�E_�E_�Ej�Ej��rHc��XlgrJ�rn)r��levels  rG�set_http_debuglevel�'AbstractHTTPHandler.set_http_debuglevel�s�� �rHc��[RRRURUR55$rJ)rr'rl�_get_content_lengthrCr��r�r{s  rGrv�'AbstractHTTPHandler._get_content_length�s2���{�{�)�)�=�=��L�L���� �"�	"rHc�Z�URnU(d[S5eURb�URn[U[5(a
Sn[U5eUR
S5(dURSS5 UR
S5(dXUR
S5(dBURU5nUbURS[	U55 OURSS5 UnUR5(a$[UR5upx[U5upiUR
S5(dURSU5 URRH>up�U
R5n
UR
U
5(aM-URX�5 M@ U$)	N�
no host givenz\POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str.zContent-type�!application/x-www-form-urlencodedr��Transfer-encoding�chunkedru)r|rrCrrr�r�r�rvr�rr�r
r5r�r�)r�r{r|rCrC�content_length�sel_hostrf�sel�sel_pathr]r�s            rG�do_request_�AbstractHTTPHandler.do_request_�sw���|�|����?�+�+��<�<�#��<�<�D��$��$�$�D����n�$��%�%�n�5�5��/�/�"�7�9��&�&�'7�8�8�#�.�.�/B�C�C�!%�!9�!9�'�!B��!�-��3�3�,�c�.�.A�C��3�3�/��<��������$�W�%5�%5�6�K�F�!+�C���H��!�!�&�)�)��+�+�F�H�=��;�;�1�1�K�D��?�?�$�D��%�%�d�+�+��/�/��<�2�
�rHc	��URnU(d[S5eU"U4SUR0UD6nURUR5 [UR5nURURR5VVs0sHupxXv;dMXx_M snn5 SUS'UR5V	V
s0sHup�U	R5U
_M nn	n
UR(a+0nSnX�;aXlX�'Xl	URURUS9 URUR5URUR UUR#S5S9 UR'5nUR*(a!UR*R)5 S	UlUR-5UlUR0UlU$s snnfs sn
n	f![$an
[U
5eS	n
A
ff=f! UR)5 e=f)
z�Return an HTTPResponse object for the request, using http_class.

http_class must implement the HTTPConnection API from http.client.
rzrDr��
Connectionrf�rhr|)�encode_chunkedN)r|rrD�set_debuglevelrnrr��updaterhr��titler��
set_tunnelr{r�r�rCr�rq�getresponser��sockr�rB�reasonrC)r��
http_classr�http_conn_argsr|r0rhrXrYr]r��tunnel_headers�proxy_auth_hdr�errr�s               rGr��AbstractHTTPHandler.do_open�s���
�x�x����?�+�+�
�t�C�S�[�[�C�N�C��	����)�)�*��s�,�,�-��������):�):�)<�-�)<����+����)<�-�	.�!(����6=�m�m�o�F�o���4�:�:�<��$�o��F�����N�2�N��(�18�1H��.��+�
�L�L��)�)�>�L�B�		�
$��	�	�#�.�.�*�C�L�L�#�(�(�G�),���8K�)L��N��
�
��A�
�6�6�
�F�F�L�L�N��A�F�� � �"�����������e-��G�� �
$��s�m�#��
$��	�
�G�G�I��s=�G
�G
�G�AG�#G6�
G3�#G.�.G3�3G6�6H	rqrJ)
r�r�r�r�r�rsrvr�r�r�r�rHrGrjrj�s��k�!�"�
$�L@rHrjc�2�\rSrSrSr\RrSrg)r*iAc�V�UR[RRU5$rJ)r�rr'rl�r�rs  rG�	http_open�HTTPHandler.http_openCs���|�|�D�K�K�6�6��<�<rHr�N)	r�r�r�r�r�rjr�rr�r�rHrGr*r*As��=�'�2�2�LrHr*r&c�<�\rSrSrSSjrSr\RrSr	g)r?iJNc�*�UbUO#[RRRn[RX5 UcC[RRRn[RRU5nUbX2lX l	grJ)
rr'r&rmrjr��	_http_vsn�_create_https_context�check_hostname�_context)r�rmr=r��http_versions     rGr��HTTPSHandler.__init__Lsk��'1�'=��4�;�;�C^�C^�Ci�Ci�J��(�(��:���#�{�{�:�:�D�D���+�+�;�;�L�I���)�)7�&�#�MrHc�h�UR[RRUURS9$)Nr<)r�rr'r&r�r�s  rG�
https_open�HTTPSHandler.https_openVs-���<�<���� ;� ;�S�(,�
�
� �7�
7rH)r��NNN)
r�r�r�r�r�r�rjr�r	r�r�rHrGr?r?Js��	$�	7�,�7�7�
rHr?c�2�\rSrSrSSjrSrSr\r\rSr	g)ri^Nc�R�SSKnUcURR5nXlgr)�http.cookiejar�	cookiejar�	CookieJar)r�r�rs   rGr��HTTPCookieProcessor.__init___s"��������0�0�2�I�"�rHc�<�URRU5 U$rJ)r��add_cookie_headerrws  rGr� HTTPCookieProcessor.http_requestes�����(�(��1��rHc�<�URRX!5 U$rJ)r��extract_cookies)r�r{r�s   rGrD�!HTTPCookieProcessor.http_responseis�����&�&�x�9��rH)r�rJ)
r�r�r�r�r�rrDr	rGr�r�rHrGrr^s��#���!�M�"�NrHrc��\rSrSrSrSrg)r/ipc�6�URn[SU-5e)Nzunknown url type: %s)r�r)r�rr�s   rGr�UnknownHandler.unknown_openqs���x�x���-��4�5�5rHr�N)r�r�r�r�rr�r�rHrGr/r/ps��6rHr/c�z�0nUH2nURSS5up4USS:XaUSS:XaUSSnXAU'M4 U$)z>Parse list of key=value strings where keys are not duplicated.�=rSrr�rP)r�)�l�parsed�eltrXrYs     rGr%r%usQ��
�F����y�y��a� ����Q�4�3�;�1�R�5�C�<��!�B��A��q�	�	�
�MrHc�F�/nSnS=p4UHXnU(aX%-
nSnMU(aUS:XaSnM#US:XaSnX%-
nM1US:XaURU5 SnMLUS:XaSnX%-
nMZ U(aURU5 UVs/sHo"R5PM sn$s snf)aXParse lists as described by RFC 2068 Section 2.

In particular, parse comma-separated lists where the elements of
the list may include quoted-strings.  A quoted-string could
contain a comma.  A non-quoted string could have quotes in the
middle.  Neither commas nor quotes count if they are escaped.
Only double-quotes count, not single-quotes.
rtF�\Tr�rC)r_r�)r9�res�part�escaper
�curs      rGr'r's���
�C�
�D���F�����K�D��F����d�{����������K�D���#�:��J�J�t���D���#�:��E����-�2��
�
�4��%(�)�S�T�J�J�L�S�)�)��)s�Bc�*�\rSrSrSrSrSrSrSrg)r+i�c��URnUSSS:XaTUSSS:waKUR(a:URS:wa*URUR5;a[S5egUR	U5$)Nr;rwr�ra�	localhost�-file:// scheme is supported only on localhost)r�r|�	get_namesr�open_local_file)r�rrBs   rG�	file_open�FileHandler.file_open�sm���l�l���r��7�d�?�s�1�Q�x�3��C�H�H����K�'��8�8�t�~�~�/�/��N�O�O�0��'�'��,�,rHNc��[Rci[[R"S5S[R"[R
"55S-5[l[R$[R$![Ra2 [R"S54[l[R$f=f)Nr�r;)r+�namesr�r#�gethostbyname_ex�gethostname�gaierror�
gethostbynamer�s rGr��FileHandler.get_names�s������$�
I�$)��+�+�K�8��;��+�+�F�,>�,>�,@�A�!�D�E�%F��!�
� � � �{� � � ���?�?�
I�%+�%9�%9�+�%F�$H��!�� � � �
I�s�AB�4C�Cc�r�SSKnSSKnURnURn[	U5n[
R"U5nURnURRURSS9n	URU5Sn
UR"SU
=(d SX�4-5nU(a
[U5upLU(a$W(dH[U5UR5;a+U(a	SU-U-n
OSU-n
[![#US5X�5$['S5e![$an['U5eSnAff=f)	NrT��usegmtz6Content-type: %s
Content-length: %d
Last-modified: %s
�
text/plain�file://�rbzfile not on local host)�email.utils�	mimetypesr|r�r5rX�stat�st_size�utils�
formatdate�st_mtime�
guess_type�message_from_stringr�_safe_gethostbynamer�rrArqr)r�r�emailr�r|rd�	localfile�statsrl�modified�mtyperhr��origurl�exps               rGr��FileHandler.open_local_file�s�����x�x���<�<�� ��*�	�	 ��G�G�I�&�E��=�=�D��{�{�-�-�e�n�n�T�-�J�H��(�(��2�1�5�E��/�/�K��&�,��7�8�9�G��'��-�
����1�$�7�4�>�>�;K�K��'�$�.��9�G�'�(�2�G�!�$�y�$�"7��J�J��/�0�0���	 ��3�-���	 �s�C#D�
D6�&D1�1D6r�)	r�r�r�r�r�r�r�r�r�r�rHrGr+r+�s��-�
�E�!�1rHr+c�d�[R"U5$![Ra gf=frJ)r#r�r�)r|s rGr�r��s.����#�#�D�)�)���?�?����s��/�/c� �\rSrSrSrSrSrg)r,i�c��SSKnSSKnURnU(d[S5e[	U5upEUc
UR
nO[
U5n[U5updU(a[U5upgOSn[U5nU=(d SnU=(d Sn[R"U5n[UR5up�U	RS5n[![#[U55nUSSUSp�U(aUS(dUSSnUR%XgXEX�R&5n
U=(a S=(d SnU
H?n[)U5unnUR+5S	:XdM'US
;dM/UR-5nMA U
R/X�5unnSnUR1UR25SnU(aUSU--
nUbUS:�aUSU--
n[4R6"U5n[9UUUR25$![an[U5eSnAff=f!UR:an[U5UeSnAff=f)
Nr�ftp error: no host givenrtrarPrSr�Dr���a�Ar�rr[r�zContent-type: %s
zContent-length: %d
)�ftplibr�r|rr�FTP_PORTr`rrrr#r�rqrr�r�r��map�connect_ftprDrrz�upper�retrfiler�rvr�r�r�
all_errors)r�rr�r�r|r�r�r�rCrY�attrs�dirsrL�fwr��attrr�rg�retrlenrhr�r�s                      rG�ftp_open�FTPHandler.ftp_open�s�����x�x����5�6�6���%�
���<��?�?�D��t�9�D� ��%�
���'��-�L�D�&��F��t�}���z�r����2��	 ��'�'��-�D�!����.����z�z�#����C���&�'���#�2�Y��R��d���Q�����8�D�	)��!�!�$��D�+�+�N�B��<�C�&�3�D���)�$�/���e��:�:�<�6�)��:�:� �;�;�=�D�	�
�+�+�d�1�K�B���G��(�(����6�q�9�E���/�%�7�7���"�w�!�|��1�G�;�;���/�/��8�G��b�'�3�<�<�8�8��1�	 ��3�-���	 ��2� � �	)��3�-�S�(��	)�s>�H�AH �&H �.BH �
H�
H�H� I�0H<�<Ic
��[XX4XVSS9$)NF)�
persistent)�
ftpwrapper)r�r�r�r|r�r�rDs       rGr��FTPHandler.connect_ftps���$��D�%*�,�	,rHr�N)r�r�r�r�r�r�r�r�rHrGr,r,�s
��2)�h,rHr,c�8�\rSrSrSrSrSrSrSrSr	Sr
g	)
r-ic�J�0Ul0UlSUlSUlSUlg)Nr�<r1)�cacherD�soonest�delay�	max_connsr�s rGr��CacheFTPHandler.__init__s%����
���������
���rHc��XlgrJ)r)r��ts  rG�
setTimeout�CacheFTPHandler.setTimeout&s���
rHc��XlgrJ)r)r�rVs  rG�setMaxConns�CacheFTPHandler.setMaxConns)s���rHc�z�XUSRU5U4nXpR;a0[R"5UR-URU'OI[XX4XV5URU'[R"5UR-URU'UR
5 URU$)Nra)�joinrr2rrDr��check_cache)r�r�r�r|r�r�rDr�s        rGr��CacheFTPHandler.connect_ftp,s����$�������7���*�*�� $�	�	��d�j�j� 8�D�L�L���(��t�)-�8�D�J�J�s�O� $�	�	��d�j�j� 8�D�L�L��������z�z�#��rHc���[R"5nURU::aj[URR	55HCup#X1:dMUR
UR
5 UR
U	URU	ME [[URR555Ul[UR
5UR:Xa�[URR	55H0up#X0R:XdMUR
U	URU	 O [[URR555UlggrJ)r2rr�rDr�rr��min�valuesrbr)r�r
rXrYs    rGr�CacheFTPHandler.check_cache7s���I�I�K���<�<�1���T�\�\�/�/�1�2����5��J�J�q�M�'�'�)��
�
�1�
����Q��	3�
�4���� 3� 3� 5�6�7����t�z�z�?�d�n�n�,��T�\�\�/�/�1�2������$��
�
�1�
����Q���	3�
�t�D�L�L�$7�$7�$9�:�;�D�L�
-rHc���URR5HnUR5 M URR5 URR5 grJ)rrr��clearrD)r��conns  rG�clear_cache�CacheFTPHandler.clear_cacheKsB���J�J�%�%�'�D��J�J�L�(��
�
���������rH)rrrrrDN)r�r�r�r�r�rrr�rrr�r�rHrGr-r-s �����	�<�(rHr-c��\rSrSrSrSrg)r.iQc�|�URnURSS5up4URSS5upT[U5nURS5(a[R
"U5nUSSnU(dSn[R"SU[U54-5n[[R"U5Xb5$)Nr�rSrCz;base64i�����text/plain;charset=US-ASCIIz$Content-type: %s
Content-length: %d
)rvr�r�endswithr��decodebytesr�r�rbr�io�BytesIO)r�rrBrfrC�	mediatyperhs       rG�	data_open�DataHandler.data_openRs����l�l���y�y��Q�'����*�*�S��+��	� ��%�����i�(�(��%�%�d�+�D�!�#�2��I��5�I��+�+�,T�
��D�	�"�-#�$���"�*�*�T�*�G�9�9rHr�N)r�r�r�r�r%r�r�rHrGr.r.Qs��:rHr.rM�nt)r5r4c��USSS:XaUSSnOUSSS:XaUSSn[R"5n[R"5n[XUS9$)	zwOS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use.Nr�z///r;�z//localhost/��rb�errors)r
�getfilesystemencoding�getfilesystemencodeerrorsr��pathnamerbr,s   rGr5r5xsa���B�Q�<�5� � ���|�H�
�c�r�]�n�
,����}�H��,�,�.���.�.�0���x�6�B�BrHc��USSS:XaSU-n[R"5n[R"5n[XUS9$)zwOS-specific conversion from a file system path to a relative URL
of the 'file' scheme; not recommended for general use.Nr;rwr+)r
r-r.r
r/s   rGr4r4�sF���B�Q�<�4���h��H��,�,�.���.�.�0���X��@�@rHc���\rSrSrSrSrS\-rSSjrSr	Sr
SrS	rSS
jr
SSjrSSjrSS
jrSrSSjrSSjrSr\(aSrSSjrSrSrSrSSjrSrg)r9i�aClass to open URLs.
This is a class rather than just a subroutine because we may need
more than one set of global protocol-specific options.
Note -- this is a base class for those who don't want the
automatic handling of errors type 302 (relocated) and 401
(authorization needed).Nr�c��SSURR0-n[R"U[SS9 Uc
[5n[
US5(dS5eXlURS5Ul	URS5Ul
S	UR4S
/Ul/Ul
[RUlSUl[$Ulg)NzW%(class)s style of invoking requests is deprecated. Use newer urlopen functions/methods�classr�)�
stacklevelr�r��key_file�	cert_filez
User-Agent)�Acceptz*/*)r�r�r�r��DeprecationWarningr6r�r�r�r6r7�versionr��_URLopener__tempfilesrXrp�_URLopener__unlink�	tempcache�ftpcache)r�r��x509rCs    rGr��URLopener.__init__�s���4�7>����@W�@W�6X�Y���
�
�c�-�!�<��?� �l�G��w��'�'�D�)D�D�'�������,��
����+�.���(�$�,�,�7�9J�K�������	�	��
����!��
rHc�$�UR5 grJ)r�r�s rG�__del__�URLopener.__del__�s���
�
�rHc�$�UR5 grJ)�cleanupr�s rGr��URLopener.close�s�����rHc��UR(a4URHnURU5 M URSS2	UR(aURR	5 gg![a Mbf=frJ)r;r<rqr=r)r�rLs  rGrE�URLopener.cleanup�sn������(�(����M�M�$�'�)�
� � ��#��>�>��N�N� � �"�������s�A3�3
B�Bc�:�URRU5 g)z\Add a header to be used by the HTTP interface only
e.g. u.addheader('Accept', 'sound/basic')N)r�r_)r�rs  rG�	addheader�URLopener.addheader�s��	
�����t�$rHc���[[U55n[USS9nUR(a8XR;a)URUup4[	US5n[XTU5$[
U5upgU(dSnX`R;a-URUn[
U5upi[U	5up�X�4nOSnSU-nX`l	URSS5n[X5(aUS	:Xa*U(aURX�U5$URX5$Uc[X5"U5$[X5"Xr5$![[ 4a e["an
[#S
U
5U
eSn
A
ff=f)z6Use URLopener().open(file) instead of open(file, 'r').z%/:=&?~#+!$,;'@()*[]|�rcr�rLN�open_�-r�r�zsocket error)r	rr
r=rArrr�r
r�rTr��open_unknown_proxy�open_unknownr�rrrq)r�rrCrdrhrg�urltyperBry�	proxyhostr|r�r]rCs              rGrA�URLopener.open�s[����7�+�,����&=�>���>�>�g���7� $���w� 7��H��h��%�B��b�7�3�3�!�'�*�����G��l�l�"��L�L��)�E�!+�E�!2��G�'�	�2�N�D��/�C��E��� ���	��|�|�C��%���t�"�"�d�.?�&?���.�.�u�t�D�D��(�(��7�7�	8��|��t�*�3�/�/��t�*�3�5�5���8�$�	���	8��.�#�.�C�7��	8�s�D?�.D?�?E+�
E&�&E+c�6�[U5up4[SSU5e)�/Overridable interface to open unknown URL type.�	url errorzunknown url type�rrq)r�rrCr�rBs     rGrQ�URLopener.open_unknown�s���w�'�	���k�#5�t�<�<rHc�<�[U5upE[SSU-U5e)rVrWzinvalid proxy for %srX)r�ryrrCr�rBs      rGrP�URLopener.open_unknown_proxy�s#���w�'�	���k�#9�D�#@�%�H�HrHc��[[U55nUR(aXR;aURU$[U5upVUcXU(aUS:XaKUR	U5nUR5nUR
5 [[U5S5U4$URX5nUR5n	U(a
[US5n
O�[U5up�[U=(d S5up�[U=(d S5up�[U=(d S5up�[RRU5Sn
[ R""U
5up�UR$R'U5 [R("US5n
X)4nURbX�RU'SnSnSnSnSU	;a[+U	S	5nU(a
U"UUU5 UR-U5=n(aOU[/U5-
nU
R1U5 US-
nU(a
U"UUU5 UR-U5=n(aMOU
R
5 UR
5 US:�aUU:a[3S
UU4-U5eU$![a GN�f=f!U
R
5 f=f!UR
5 f=f)zlretrieve(url) returns (filename, headers) for a local object
or (tempfilename, headers) for a remote object.rLrSrMrtrOrPrrQrRrT)r	rr=rr�rWr�r5r
rqrArrrXrY�splitextr[�mkstempr;r_�fdopenr`rarbrcr)r�rBrdrerCr��url1rgr�rhri�garbagerY�suffix�fdrjrkrlrarmrns                     rG�retrieve�URLopener.retrievess���Y�s�^�$���>�>�c�^�^�3��>�>�#�&�&���_�
����T�T�V�^�
��)�)�$�/���w�w�y�����
�#�J�t�$4�Q�$7�8�$�>�>��Y�Y�s�
!��"	��g�g�i�G���8�T�*�� *�3��
�� *�4�:�2� 6�
�� +�D�J�B� 7�
�� *�4�:�2� 6�
�����)�)�$�/��2��!)�!1�!1�&�!9���� � �'�'��1��i�i��D�)��
�!�*���>�>�-�*0�N�N�3�'���������#�w�.��w�'7�8�9�D���x��T�2�!�w�w�r�{�*�e�*��C��J�&�D��I�I�e�$���M�H�!�"�8�R��6� "�w�w�r�{�*�e�*��	�	���H�H�J��1�9����&�C���,�� &�(�
(��
��[�
��
��F�	�	����H�H�J�s9�"A	J�>CJ6�B0J!�J6�
J�J�!J3�3J6�6Kc�H�SnSn[U[5(a/[U5upgU(a[U5upF[	U5nUnOUupg[U5upV[U5up�U
nSnU	R
5S:waSnOF[U
5up�U(a
[U5upHU(aU	<SU<U
<3n[U5(aUnU(d[SS5eU(a?[	U5n[R"UR55RS5nOSnU(a?[	U5n[R"UR55RS5nOSnU"U5n
0nU(aSU-US'U(aSU-US	'U(aX�S
'SUS'URH
unnUX�'M UbS
US'U
RSXsU5 OU
RSX~S9 U
R5nSUR(s=::aS:a(O O%[+UUR,SU-UR(5$UR/UUR0UR(UR2UR,U5$![ R"R$a ['S5ef=f)aQMake an HTTP connection using connection_class.

This is an internal method that should be called from
open_http() or open_https().

Arguments:
- connection_factory should take a host name and return an
  HTTPConnection instance.
- url is the url to retrieval or a host, relative-path pair.
- data is payload for a POST request or None.
Nrz://z
http errorrzr�zBasic %srfr�rur�r�r{zContent-Typer�r�r�z$http protocol error: bad status liner@rA�http:)rrr
rrrrzr�rqr�r�r�r�r�r{r�rr'�
BadStatusLiner�statusrrC�
http_errorrgr�)r��connection_factoryrBrC�user_passwd�proxy_passwdr|r��realhostrRr��
proxy_authr��	http_connrhr�r�r�s                  rG�_open_generic_http�URLopener._open_generic_httpCsv�������c�3���'��_�N�D��$.�t�$4�!���t�}���H� �N�D�!+�D�!1��L�&�x�0�M�G��C��K��}�}��&�(���!+�D�!1����,6�x�,@�)�K��.5�x��F�H���)�)�#�D��7�<��A�A��"�<�0�L��)�)�,�*=�*=�*?�@�G�G��P�J��J��!�+�.�K��#�#�K�$6�$6�$8�9�@�@��I�D��D�&�t�,�	����-7�*�-D�G�)�*��(2�T�(9�G�O�$��&�F�O�
!(����!�_�_�M�F�E�#�G�O�-���&I�G�N�#����f�h�g�>����e�X��?�	C� �,�,�.�H��(�/�/�'�C�'��h����g��m�&�o�o�/�
/��?�?��X�[�[�������(�,�,��F�
F���{�{�(�(�	C��A�B�B�	C�s�*I7�7*J!c�V�UR[RRX5$)zUse HTTP protocol.)rqrr'rl�r�rBrCs   rG�	open_http�URLopener.open_http�s���&�&�t�{�{�'A�'A�3�M�MrHc��SU-n[X5(a,[X5nUcU"XX4U5n	O
U"XX4XV5n	U	(aU	$URXX4U5$)z�Handle http errors.

Derived class can override this, or provide specific handlers
named http_error_DDD where DDD is the 3-digit error code.z
http_error_%d)r�r�r)
r�rBrg�errcode�errmsgrhrCr]r�rjs
          rGrj�URLopener.http_error�s`����(���4����T�(�F��|����'�B�����'�H���f�}��&�&�s���I�IrHc�<�UR5 [XXES5e)z>Default error handler: close the connection and raise OSError.N)r�r�r�rBrgrxryrhs      rGr�URLopener.http_error_default�s��
���
���f�t�<�<rHc��UR(dUR(a~[RRR
n[RR
U5nURURUR5 URbSUlOSn[RR	XS9$)NTr<)	r6r7rr'r&r�r��load_cert_chain�post_handshake_auth)r�r|r�r=s    rG�_https_connection�URLopener._https_connection�s����}�}����#�{�{�:�:�D�D���+�+�;�;�L�I���'�'�����
�
�F��.�.�:�26�G�/�����;�;�.�.�t�.�E�ErHc�:�URURX5$)zUse HTTPS protocol.)rqr�rts   rG�
open_https�URLopener.open_https�s���*�*�4�+A�+A�3�M�MrHc���[U[5(d[S5eUSSS:Xa+USSS:wa"USSR5S:wa[	S	5eURU5$)
z/Use local file or FTP depending on form of URL.zEfile error: proxy support for file protocol currently not implementedNr;rwr�rar)z
localhost/r�)rrrrzr�r�r�s  rG�	open_file�URLopener.open_file�se���#�s�#�#��b�c�c��r��7�d�?�s�1�Q�x�3��3�q��9�?�?�3D��3T��L�M�M��'�'��,�,rHc��SSKnSSKn[U5upE[U5n[R
"U5nURn	URRURSS9n
URU5SnUR"SU=(d SX�4-5nU(d&Un
USSS:XaS	U-n
[![#US
5X�5$[%U5upNU(dl[&R("U5[+54[-5-;a>Un
USSS:XaS	U-n
OUSSS:Xa[/S
U-5e[![#US
5X�5$[S5e![a%n[URUR5eSnAff=f)zUse local file.rNTr�z6Content-Type: %s
Content-Length: %d
Last-modified: %s
r�rSrar�r�r;z./zAlocal file url may start with / or file:. Unknown url of type: %sz#local file error: not on local host)r�r�r
r5rXr�rqr�strerrorrdr�r�r�r�r�r�rrArr#r�r��thishostr�)r�rBr�r�r|rL�	localnamer��erlr�r�rh�urlfiler�s               rGr��URLopener.open_local_file�sw������_�
�� ��&�	�	3��G�G�I�&�E��}�}���;�;�)�)�%�.�.��)�F���$�$�S�)�!�,���+�+�G�
�
"�l�D�3�
4�5����G��B�Q�x�3��#�d�*���d�9�d�3�W�F�F���%�
����#�#�D�)�y�{�n�x�z�.I�J��G��B�Q�x�3��#�d�*���b�q��T�!� �!d�gj�!j�k�k��d�9�d�3�W�F�F��<�=�=��-�	3��1�:�:�q�z�z�2�2��	3�s�E�
F� E>�>Fc��[U[5(d[S5eSSKn[	U5up4U(d[S5e[U5up5[
U5upcU(a[U5upgOSn[U5n[U=(d S5n[U=(d S5n[R"U5nU(dSSKnURnO[U5n[U5upI[U5nURS5n
U
SSU
Sp�U
(aU
S(dU
SSn
U
(aU
S(dSU
S'XcUSR!U
54n[#UR$5[&:�aO[)UR$5H6n
X�:wdM
UR$U
nUR$U
	UR+5 M8 X�R$;a[-XgX5U
5UR$U'U(dS	nOS
nU	H?n[/U5unnUR15S:XdM'US;dM/UR35nMA UR$UR5X�5unnUR7S
U-5SnSnU(aUSU--
nUbUS:�aUSU--
n[8R:"U5n[=UUS
U-5$![?5an[SU35UeSnAff=f)zUse FTP protocol.zCftp error: proxy support for ftp protocol currently not implementedrNr�rtrarPrSr�rr�r�zftp:zContent-Type: %s
zContent-Length: %d
�ftp error: ) rrrr�r
rrrrr#r�r�r�r`rr�rrbr>�MAXFTPCACHEr�r�r�rrzr�r�r�r�r�r�	ftperrors)r�rBr�r|rYr�r�r�r�r�r�rLr�rXrYr�r�r�rgr�r�rhr�s                       rG�open_ftp�URLopener.open_ftp�s����#�s�#�#��`�a�a����_�
���8�$>�?�?���%�
����%�
����T� 2���v��f��t�}���t�z�r�"�����2�&���#�#�D�)�����?�?�D��t�9�D� ��&����t�}���z�z�#����#�2�Y��R��d���Q���Q�R�����Q��3��a���$������.���t�}�}���+��$�-�-�(���8��
�
�a�(�A��
�
�a�(��G�G�I�	)�
	9��-�-�'��t�T��>��
�
�c�"�����$���)�$�/���e��:�:�<�6�)��:�:� �;�;�=�D�	�
!�M�M�#�.�7�7��C�M�R���(�(��#��6�q�9�E��G���/�%�7�7���"�w�!�|��1�G�;�;���/�/��8�G��b�'�6�C�<�8�8���{�	9��[���.�/�S�8��	9�s&�AJ:�J:�&BJ:�:K�K�Kc
�v�[U[5(d[S5eURSS5up2U(dSnUR
S5nUS:�aS	X4S
;a
X4S-S
nUS
UnOSn/nURS[R"S
[R"[R"555-5 URSU-5 US:Xa5[R"URS55RS5nO[U5nURS[!U5-5 URS5 URU5 SR#U5n[$R&"U5n[(R*"U5n[-X�U5$![a
 [SS5ef=f)zUse "data" URL.zEdata error: proxy support for data protocol currently not implementedrCrSz
data errorzbad data URLr�;rr�NrtzDate: %sz%a, %d %b %Y %H:%M:%S GMTzContent-type: %sr�r�zlatin-1zContent-Length: %d�
)rrrr�r�rq�rfindr_r2�strftime�gmtimer�r!r�r�rrbrr�r�r"�StringIOr)	r�rBrCr��semirbrCrh�fs	         rG�	open_data�URLopener.open_data-s}���#�s�#�#��b�c�c�	8��9�9�S�!�,�L�T��0�D��z�z�#����1�9��D��K�/���F�G�}�H����;�D��H����
�
�:�d�m�m�,G�,0�K�K��	�	��,D�F�F�	G��
�
�%��,�-��x���%�%�d�k�k�'�&:�;�B�B�9�M�D��4�=�D��
�
�'�#�d�)�3�4��
�
�2���
�
�4���i�i��n���+�+�C�0���K�K�����!�c�*�*��5�	8��,��7�7�	8�s�F!�!F8)	�__tempfiles�__unlinkr�r7r>r6r�r=r�rJr�)r�r�r�r�rFr;r�r:r�rBr�rErJrArQrPrdrqrurjr�	_have_sslr�r�r�r�r�r�r�r�rHrGr9r9�s�����K� �;�.�G�!�4��#�%�"8�H=�
I�:�|ZF�xN�J� =�
�	F�	N�-�>�@89�t'+rHr9c��\rSrSrSrSrSrSSjrSrSSjr	SS	jr
SS
jrSSjrSSjr
SS
jrSSjrSSjrSSjrSSjrSSjrSrSrg)r:iWz?Derived class with handlers for errors we can handle (perhaps).c�b�[R"U/UQ70UD6 0UlSUlSUlg)NrrM)r9r��
auth_cache�tries�maxtries)r�rr�s   rGr��FancyURLopener.__init__Zs/�����4�1�$�1�&�1������
���
rHc�"�[X%SU-U5$)z3Default error handling -- don't raise an exception.rg)rr|s      rGr�!FancyURLopener.http_error_default`s���"�w��}�g�>�>rHNc�L�U=RS-
slUR(aVURUR:�a<[US5(a
URnOURnU"XSSU5SUl$URXX4XV5nUSUl$!SUlf=f)z%Error 302 -- relocated (temporarily).rS�http_error_500r2z)Internal Server Error: Redirect Recursionr)r�r�r�r�r�redirect_internal)	r�rBrgrxryrhrCr�rjs	         rGrp�FancyURLopener.http_error_302ds����
�
�a��
�
	��}�}����t�}�}�!<��4�!1�2�2��.�.�D��2�2�D��C�S�G�#�%��D�J�	�+�+�C�W�,3�;�F���D�J���D�J�s�AB�>B�	B#c�
�SU;aUSnO
SU;aUSnOgUR5 [URS-U-U5n[U5nURS;a[XsUSU--XR5eUR
U5$)Nr]r^r�r_z( Redirection to url '%s' is not allowed.)r�rr�rrfrrA)	r�rBrgrxryrhrCrUrms	         rGr�� FancyURLopener.redirect_internalvs����� ��Z�(�F�
�g�
��U�^�F��
���
�����S��3�.��7���F�#���?�?�">�>��F�"�F��O�P�#�)�
)�
�y�y�� � rHc�(�URXX4XV5$)z*Error 301 -- also relocated (permanently).�rp�r�rBrgrxryrhrCs       rGrr�FancyURLopener.http_error_301�����"�"�3�G�W�K�KrHc�(�URXX4XV5$)z;Error 303 -- also relocated (essentially identical to 302).r�r�s       rGrs�FancyURLopener.http_error_303�r�rHc�T�UcURXX4XV5$URXX4U5$)z1Error 307 -- relocated, but turn POST into error.)rprr�s       rGrt�FancyURLopener.http_error_307��1���<��&�&�s���O�O��*�*�3�G�W�M�MrHc�T�UcURXX4XV5$URXX4U5$)z1Error 308 -- relocated, but turn POST into error.)rrrr�s       rGru�FancyURLopener.http_error_308�r�rHc���SU;a[RXUX4U5 USn[R"SU5n	U	(d[RXUX4U5 U	R	5up�U
R5S:wa[RXUX4U5 U(d[RXX#UU5 SUR-S-nUc[X5"X5$[X5"XU5$)zWError 401 -- authentication required.
This function supports Basic authentication only.r�![ 	]*([^ 	]+)[ 	]+realm="([^"]*)"r��retry_�_basic_auth�r9rr�matchr�rzr�r��
r�rBrgrxryrhrCrc�stuffr�rfr�r]s
             rGr
�FancyURLopener.http_error_401�s����W�,��(�(��B�)0�'�
C��*�+�����?��G����(�(��B�)0�'�
C�����
���<�<�>�W�$��(�(��B�)0�'�
C���(�(��B���
��$�)�)�#�m�3���<��4�%�c�1�1��4�%�c�$�7�7rHc���SU;a[RXUX4U5 USn[R"SU5n	U	(d[RXUX4U5 U	R	5up�U
R5S:wa[RXUX4U5 U(d[RXX#UU5 SUR-S-nUc[X5"X5$[X5"XU5$)z]Error 407 -- proxy authentication required.
This function supports Basic authentication only.rr�r��retry_proxy_r�r�r�s
             rGr�FancyURLopener.http_error_407�s��� �w�.��(�(��B�)0�'�
C��,�-�����?��G����(�(��B�)0�'�
C�����
���<�<�>�W�$��(�(��B�)0�'�
C���(�(��B���
���	�	�)�M�9���<��4�%�c�1�1��4�%�c�$�7�7rHc��[U5upESU-U-nURSn[U5up�[U	5up�U	RS5S-nX�Sn	UR	X�U5up�U(dU
(dg[USS9<S[U
SS9<SU	<3n	SU	-U
-URS'UcUR
U5$UR
Xc5$)N�http://rrxrSrtrMr��r
r�rr��get_user_passwdr
rA�r�rBr�rCr|r�rUryrRrS�
proxyselectorr�r�r�s              rG�retry_proxy_http_basic_auth�*FancyURLopener.retry_proxy_http_basic_auth�s���#�C�����T�!�H�,�����V�$��'��.���#-�i�#8� �	��N�N�3��!�#���b�M�	��+�+�I�a�@������"'��2�"6�"'��R�"8�)�E�	�(�9�4�}�D����V���<��9�9�V�$�$��9�9�V�*�*rHc��[U5upESU-U-nURSn[U5up�[U	5up�U	RS5S-nX�Sn	UR	X�U5up�U(dU
(dg[USS9<S[U
SS9<SU	<3n	SU	-U
-URS'UcUR
U5$UR
Xc5$)N�https://r�rxrSrtrMr�r�r�s              rG�retry_proxy_https_basic_auth�+FancyURLopener.retry_proxy_https_basic_auth�s���#�C�����d�"�X�-�����W�%��'��.���#-�i�#8� �	��N�N�3��!�#���b�M�	��+�+�I�a�@������"'��2�"6�"'��R�"8�)�E�	� *�Y� 6�� F����W���<��9�9�V�$�$��9�9�V�*�*rHc�&�[U5upEURS5S-nXFSnURXBU5upxU(dU(dg[USS9<S[USS9<SU<3nSU-U-n	UcUR	U	5$UR	X�5$)NrxrSrtrMr�r��r
r�r�r
rA�
r�rBr�rCr|r�r�r�r�rUs
          rGr��$FancyURLopener.retry_http_basic_auth�s���#�C�����I�I�c�N�Q����B�x���+�+�D��;������"�4�b�1�"�6��3�T�;���T�!�H�,���<��9�9�V�$�$��9�9�V�*�*rHc�&�[U5upEURS5S-nXFSnURXBU5upxU(dU(dg[USS9<S[USS9<SU<3nSU-U-n	UcUR	U	5$UR	X�5$)NrxrSrtrMr�r�r�r�s
          rG�retry_https_basic_auth�%FancyURLopener.retry_https_basic_auth	s���#�C�����I�I�c�N�Q����B�x���+�+�D��;������"�4�b�1�"�6��3�T�;���d�"�X�-���<��9�9�V�$�$��9�9�V�*�*rHc��US-UR5-nX@R;a$U(aURU	OURU$URX5upVU(dU(aXV4URU'XV4$)Nrx)rzr��prompt_user_passwd)r�r|r�rr�r�r�s       rGr��FancyURLopener.get_user_passwd	sl���c�k�D�J�J�L�(���/�/�!���O�O�C�(����s�+�+��.�.�t�;����6�4�.�4�?�?�3�/��|�rHc	��SSKn[SU<SU<S35nURSU<SU<SU<S35nXE4$![a
 [5 gf=f)	z#Override this in a GUI environment!rNzEnter username for z at z: zEnter password for z in r�)�getpass�input�KeyboardInterrupt�print)r�r|r�r�r�r�s      rGr��!FancyURLopener.prompt_user_passwd%	sR���	��E�4�H�I�D��_�_��u�d�&$�%�F��<��� �	��G��	�s�4;�A�A)r�r�r�rJ)NF)r)r�r�r�r�rFr�rrpr�rrrsrtrur
rr�r�r�r�r�r�r�r�rHrGr:r:Wsm��I��?��$!�8L�L�N�N�FJ��8�2FJ��8�2+�$+�$+�+�	�
rHr:c�H�[c[R"S5q[$)z8Return the IP address of the magic hostname 'localhost'.r�)�
_localhostr#r�r�rHrGr�r�5	s �����)�)�+�6�
��rHc��[c<[[R"[R"55S5q[$[$![R
a* [[R"S5S5q[$f=f)z,Return the IP addresses of the current host.r;r�)�	_thishostr�r#r�r�r�r�rHrGr�r�=	sw����	G��f�5�5�f�6H�6H�6J�K�A�N�O�I���9������	G��f�5�5�k�B�1�E�F�I���	G�s�5A
�
6B�Bc�<�[cSSKnURq[$)z1Return the set of errors raised by the FTP class.Nr)�
_ftperrorsr�r�)r�s rGr�r�H	s������&�&�
��rHc�H�[c[R"S5q[$)z%Return an empty email Message object.rt)�
_noheadersr�r�r�rHrG�	noheadersr�Q	s �����.�.�r�2�
��rHc�J�\rSrSrSrSSjrSrSrSrSr	S	r
S
rSrg)
r�i[	z;Class used by open_ftp() for cache of open FTP connections.Nc��XlX lX0lX@lXPlX`lSUlXplUR5 g! UR5 e=fr)
r�r�r|r�r�rD�refcount�	keepalive�initr�)r�r�r�r|r�r�rDr�s        rGr��ftpwrapper.__init__^	sM���	����	��	��	�����
�#��	��I�I�K��	��J�J�L��s�A�Ac��SSKnSUlUR5UlURR	UR
URUR5 URRURUR5 SRUR5nURRU5 g)Nrra)r��busy�FTPr`�connectr|r�rD�loginr�r�rr��cwd)r�r��_targets   rGr��ftpwrapper.initn	sw�����	��:�:�<�����������D�I�I�t�|�|�<������t�y�y�$�+�+�.��(�(�4�9�9�%�������W�rHc�h�SSKnUR5 US;aSnSnOSU-nSnURRU5 SnU(a*U(d#SU-nURR
U5upgU(d�URRS5 U(aYURR5n	URRU5 URRU	5 SU-nOSnURR
U5upgSUl[URS
5UR5n
U=R S-
slUR#5 U
W4$!URa/ UR5 URRU5 GNgf=f!URa,n[U5SSS:wa[S	U35UeSnAGNoSnAff=f!URan[S
U-5UeSnAff=f!URRU	5 f=f)Nr)r[r�zTYPE ArSzTYPE zRETR r��550r�z
ftp error: %rzLIST �LISTr�)r��endtransferr`�voidcmdr�r��ntransfercmd�
error_permrr�pwdr�r�r�makefile�
file_closer�r�)r�rLr�r��cmd�isdirrr�r�r�ftpobjs           rGr��ftpwrapper.retrfilew	s���������:��X�s�q�u��d�N�c�A�E�	"��H�H���S�!�����
G���n�� $��� 5� 5�c� :�
����H�H���X�&���h�h�l�l�n��&�M������T�*��H�H�L�L��%���n���� �H�H�1�1�#�6�M�D���	��d�m�m�D�1�4�?�?�C���
�
���
��
�
���� � ��G� � �	"��I�I�K��H�H���S�!�	"���$�$�
G��v�;�r��?�e�+�"�[���#9�:��F�,��
G��"�,�,�M�&���'?�@�f�L��M���H�H�L�L��%�sM�E,�"F.�;G-�,;F+�*F+�.G*�>!G%�%G*�-H�=H�H�H�H1c��UR(dgSUlURR5 g![5a gf=fr)r�r`�voidrespr�r�s rGr�ftpwrapper.endtransfer�	s<���y�y����	�	��H�H������{�	��	�s�6�A�Ac�T�SUlURS::aUR5 gg)NFr)r�r��
real_closer�s rGr��ftpwrapper.close�	s$������=�=�A���O�O��rHc��UR5 U=RS-slURS::a#UR(dUR5 ggg)NrSr)rr�r�rr�s rGr�ftpwrapper.file_close�	s@�������
�
���
��=�=�A��d�n�n��O�O��'5�rHc��UR5 URR5 g![5a gf=frJ)rr`r�r�r�s rGr�ftpwrapper.real_close�	s5������	��H�H�N�N����{�	��	�s�-�>�>)
r�r�r`r|r�r�r�r�rDr�)NT)
r�r�r�r�rFr�r�r�rr�rrr�r�rHrGr�r�[	s/��E�?C� �� �*!�X��
�rHr�c���0n/n[RH~n[U5S:�dMUSS:XdMUSSR5S:XdM8[RUnUSSR5nUR	X#U45 U(dMzX0U'M� S[R;aURSS5 UH0up#nUSSS	:XdMU(aX0U'MURUS5 M2 U$)
aReturn a dictionary of scheme -> proxy server URL mappings.

Scan the environment for variables named <scheme>_proxy;
this seems to be the standard convention.  If you need a
different way, you can pass a proxies dictionary to the
[Fancy]URLopener constructor.
r i����r����Nry�REQUEST_METHODr�_proxy)rX�environrbrzr_r�)r��environmentr]r��
proxy_names     rG�getproxies_environmentr�	s����G��K��
�
���t�9�q�=�T�"�X��_��b�c����1B�g�1M��J�J�t�$�E��c�r����*�J�����Z�8�9��u�&+�
�#���2�:�:�%����F�D�!�#.���Z����9�� ��&+�
�#����J��-�
$/��NrHc��Uc
[5nUSnUS:XagUR5n[U5up4UR	S5H|nUR5nU(dMUR
S5nUR5nX5:XdX:Xa gSU-nURU5(dURU5(dM| g g![a gf=f)z�Test if proxies should not be used for a particular host.

Checks the proxy dict for the value of no_proxy, which should
be a list of comma separated DNS suffixes, or '*' for all hosts.

�noF�*TrC�.)rrDrzrr�r��lstripr )r|r��no_proxy�hostonlyr�r]s      rG�proxy_bypass_environmentr$�	s�����(�*����4�=���3����:�:�<�D���%�N�H����s�#���z�z�|���4��;�;�s�#�D��:�:�<�D���4�<����:�D�� � ��&�&�$�-�-��*=�*=��$���)����s�C
�

C�Cc�@�SSKJn SSKJnJn [	U5upVSnSU;aUS(agSn[U"U55nUR
S	S
5H�n	U	(dM[R"SU	5n
U
b�Ub�U"U
RS55nU
RS
5nUc'SU
RS5RS5S--nO[USS5nUS:dUS:�aM�SU-
nX�-	X�-	:Xa gM�U"X	5(dM� g g!Ua N�f=f)aJ
Return True iff this host shouldn't be accessed using a proxy

This function uses the MacOSX framework SystemConfiguration
to fetch the proxy information.

proxy_settings come from _scproxy._get_proxy_settings or get mocked ie:
{ 'exclude_simple': bool,
  'exceptions': ['foo.bar', '*.bar.com', '127.0.0.1', '10.1', '10.0/16']
}
r��fnmatch)�AddressValueError�IPv4Addressc���URS5n[[[U55n[	U5S:wa
U/SQ-SSnUSS-USS--USS	--US
-$)Nr rL)rrrrr�rSr1r;r0r�)r�r�r�r`rb)�ipAddrr�s  rG�ip2num�,_proxy_bypass_macosx_sysconf.<locals>.ip2num
sm�����S�!���S��e�_�%���u�:��?��\�)�2�A�.�E��a��B��5��8�r�>�2�e�A�h�!�m�D�u�Q�x�O�OrHr �exclude_simpleTN�
exceptionsr�z(\d+(?:\.\d+)*)(/\d+)?rSr;r0� F)r'�	ipaddressr(r)rr`r�rr��group�count)
r|�proxy_settingsr'r(r)r#r�r-�hostIPr�rVr��masks
             rG�_proxy_bypass_macosx_sysconfr8	
s.�� �8���%�N�H�P��$���*�+��
�F�
��[��*�+�� �#�#�L�"�5���h��H�H�.��6���=�V�/��!�'�'�!�*�%�D��7�7�1�:�D��|��A�G�G�A�J�,�,�S�1�A�5�6���4���8�}���a�x�4�"�9����9�D���D�L�1��2��T�
!�
!��/6�2��9�
��
�s�D�D�Dc��SSKJn [U5upURS5nUH2nUR5nUS:Xa
SU;a gM#U"X5(dM2 g g)z�Return True if the host should bypass the proxy server.

The proxy override list is obtained from the Windows
Internet settings proxy override registry value.

An example of a proxy override value is:
"www.example.com;*.example.net; 192.168.0.1"
rr&r�z<local>r TF)r'rr�r�)r|�overrider'r��proxy_overrider�s      rG�_proxy_bypass_winreg_overrider<I
s`�� ����G�D��^�^�C�(�N����z�z�|���9���$����
�T�
 �
 ���rH�darwin)�_get_proxy_settings�_get_proxiesc�,�[5n[X5$rJ)r>r8)r|r5s  rG�proxy_bypass_macosx_sysconfrAd
s��,�.��+�D�A�ArHc��[5$)z�Return a dictionary of scheme -> proxy server URL mappings.

This function uses the MacOSX framework SystemConfiguration
to fetch the proxy information.
)r?r�rHrG�getproxies_macosx_sysconfrCh
s���~�rHc�P�[5nU(a[X5$[U5$)z�Return True, if host should be bypassed.

Checks proxy settings gathered from the environment, if specified,
or from the MacOSX framework SystemConfiguration.

)rr$rA�r|r�s  rGr�r�r
s%��)�*���+�D�:�:�.�t�4�4rHc�8�[5=(d
 [5$rJ)rrCr�rHrGr6r6
s��%�'�F�+D�+F�FrHc��0nSSKnURURS5nUR	US5SnU(Ga	[UR	US5S5nSU;aSU;aSR
U5nURS5HNnURSS	5upg[R"S
U5(dUS;aSU-nOUS
:XaSU-nXpU'MP URS
5(aU[R"SSUS
5nURS5=(d UUS'URS5=(d UUS'UR5 U$![a Us$f=f![[[4a U$f=f)zhReturn a dictionary of scheme -> proxy server URL mappings.

Win32 uses the registry to store proxies.

rN�;Software\Microsoft\Windows\CurrentVersion\Internet Settings�ProxyEnable�ProxyServerr�r�zhttp={0};https={0};ftp={0}rSz
(?:[^/:]+)://)rr�r`r��sockszsocks://z	^socks://z	socks4://rr�)�winreg�ImportError�OpenKey�HKEY_CURRENT_USER�QueryValueExrr�r�rr�r�ry�Closerqr�r�)r�rL�internetSettings�proxyEnable�proxyServer�pr��addresss        rG�getproxies_registryrW�
s�����	��"	�%�~�~�f�.F�.F�N� P�� �-�-�.>�/<�>�>?�A�K��!�&�"5�"5�6F�7D�#F�FG�#I�J���k�)�c��.D�">�"E�"E�k�"R�K�$�*�*�3�/�A�()����Q��%�H��8�8�O�W�=�=�#�'?�?�&/�'�&9�G�%��0�&0�7�&:�G�(/�H�%�0��;�;�w�'�'� �f�f�\�;���@P�Q�G�&-�k�k�&�&9�&D�W�G�F�O�'.�{�{�7�';�'F�w�G�G�$��"�"�$����M�	��N�	��B��Y�/�	�
���	�s#�E�EE/�E,�+E,�/F�Fc�8�[5=(d
 [5$)z�Return a dictionary of scheme -> proxy server URL mappings.

Returns settings gathered from the environment, if specified,
or the registry.

)rrWr�rHrGr6r6�
s��&�'�@�+>�+@�@rHc� �SSKnURURS5nUR	US5Sn[UR	US5S5nU(aU(dg[X5$![a gf=f![a gf=f)NrFrHrI�
ProxyOverride)rLrMrNrOrPrrqr<)r|rLrRrS�
proxyOverrides     rG�proxy_bypass_registryr\�
s���	��		�%�~�~�f�.F�.F�N� P�� �-�-�.>�/<�>�>?�A�K��� 3� 3�4D�5D�!F�FG�!I�J�M�
�-��,�T�A�A���	��	���	��	�s#�A0�AB�0
A=�<A=�
B
�B
c�P�[5nU(a[X5$[U5$)zReturn True, if host should be bypassed.

Checks proxy settings gathered from the environment, if specified,
or the registry.

)rr$r\rEs  rGr�r��
s%��)�*���+�D�:�:�(��.�.rHr�rJ)~rFr�r�r�r5�http.clientrr"rXrr#rhr
r2r[rUr��urllib.errorrrr�urllib.parserrrr	r
rrr
rrrrrrrrrr�urllib.responserr�sslr�rM�__all__�version_infor�r@r$r1r2r^r7r8r�ASCIIrxr}rrr3rr0rrr�r r!r"r#r$r%r&�urandomr4r'r(r)rjr*r�r'r?r_rr/r%r'r+r�r,r-r.r�r]�
nturl2pathr5r4r>r9r:r�r�r�r�r�r�r�r�r�rr$r8r<�platform�_scproxyr>r?rArCr�r6rWr\r�rHrG�<module>rjs��C�f�
����	�	�	�
�
�
�����C�B�"�"�"�"�"�
5����I���$��(�(��!�,�,��
���F�$B�$B�3+��3+�j���:�x��z�z�(�B�H�H�-��� k"�k"�ZI+�I+�^"�H8�8�&#��#�";�k�;�o2�+�o2�d,�B)>�;�)>�V=*�=*�@G�o�G�3�#B�3�>k#�k#�^�3�[���4�k�� �z�z��O�O�d�K�)B��$
�[�*C�
�s�+�s�l3�%�3��4�;�;�)�*�*�8�*�8�$�N�N�>�"�#�+�#�$6�[�6�
�)*�V11�+�11�f�7,��7,�r3�j�3�j:�+�:�B���7�7�d�?�5�5�C�	A���+�+�DX�Y�X�z�
��
�	���
���
��a�a�H#�J �J<�@�0�<�<�8��:�B��5�G��W�W��_�/�bA�B�(/�(�J�+�L��eS���I��s�:K�K&�%K&
© 2025 GrazzMean-Shell