Hacked By AnonymousFox
�
�܋fx � � � d Z ddlmZmZmZmZ ddlmZmZm Z m
Z
mZmZm
Z
mZ ddlmZmZmZ ddlZddlZddlZddlZddlmZ ddlmZ dd lmZmZmZ dd
l m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3m4Z4 ddl5Z5ddl6Z6ddl7Z7ddl8Z8ddl9Z9ddl:Z:ddl;Z;ddl<Z<ddl=Z=ddl>Z>ddlmZ erdd
l?m@Z@ ndd
lAm@Z@ ddlBZBddlBmCZC dZDn
# eE$ r dZDY nw xY wg d�ZFe:jG dd� ZHdaIde9jJ fd�ZKd� ZLg ZMdid�ZNd� ZOer e8jP de8jQ � � ZRn e8jP d� � ZRd� ZS G d� deT� � ZU G d� deT� � ZVd� ZW G d� deT� � ZX G d � d!eX� � ZY G d"� d#eX� � ZZ G d$� d%eX� � Z[d&� Z\ G d'� d(eX� � Z] G d)� d*eT� � Z^ G d+� d,e^� � Z_ G d-� d.eT� � Z` G d/� d0e`eX� � Za G d1� d2e`eX� � Zbe6jc Zd G d3� d4eT� � Ze G d5� d6eXee� � Zf G d7� d8eXee� � Zg G d9� d:eX� � Zh G d;� d<eh� � Zi ejed=� � r# G d>� d?eh� � ZkeF�l d?� � G d@� dAeX� � Zm G dB� dCeX� � ZndD� ZodE� Zp G dF� dGeX� � ZqdH� Zr G dI� dJeX� � Zs G dK� dLes� � ZtdMZue6jv dNk r ddOlwmxZxmyZy ndP� ZxdQ� Zyi Zz G dR� dSeT� � Z{ G dT� dUe{� � Z|da}dV� Z~dadW� Z�da�dX� Z�da�dY� Z� G dZ� d[eT� � Z�d\� Z�d]� Z�d^� Z�e:j� d_k rdd`l�m�Z�m�Z� da� Z�db� Z�dc� Z�dd� Z�dS e6jv dNk rde� Z�df� Z�dg� Z�dh� Z�dS e�Z�e�Z�dS )ja�
Ported using Python-Future from the Python 3.3 standard library.
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 and 307 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
IOError); 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('http://www.python.org/')
� )�absolute_import�division�print_function�unicode_literals)�bytes�dict�filter�input�int�map�open�str)�PY2�PY3�raise_with_tracebackN)�email)�client� )�URLError� HTTPError�ContentTooShortError)�urlparse�urlsplit�urljoin�unwrap�quote�unquote� splittype� splithost� splitport� splituser�splitpasswd� splitattr�
splitquery�
splitvalue�splittag�to_bytes�
urlunparse)�
addinfourl�addclosehook)r )�Iterable)�
SSLContextTF)�Request�OpenerDirector�BaseHandler�HTTPDefaultErrorHandler�HTTPRedirectHandler�HTTPCookieProcessor�ProxyHandler�HTTPPasswordMgr�HTTPPasswordMgrWithDefaultRealm�AbstractBasicAuthHandler�HTTPBasicAuthHandler�ProxyBasicAuthHandler�AbstractDigestAuthHandler�HTTPDigestAuthHandler�ProxyDigestAuthHandler�HTTPHandler�FileHandler�
FTPHandler�CacheFTPHandler�UnknownHandler�HTTPErrorProcessor�urlopen�install_opener�build_opener�pathname2url�url2pathname�
getproxies�urlretrieve�
urlcleanup� URLopener�FancyURLopener� c �D � d|v r|d }|d= nd}d|v r|d }|d= nd }d|v r|d }|d= nd }|s|s|r�t st d� � �t j t j � � }|xj t j z c_ t j |_ |s|r|� ||� � n|�
� � t |d�� � }t |� � } nt �t � � xa
} nt } | � | ||� � S )N� cadefaultF�capath�cafilezSSL support not availableT��context�check_hostname)� _have_ssl�
ValueError�sslr, �PROTOCOL_SSLv23�options�OP_NO_SSLv2�
CERT_REQUIRED�verify_mode�load_verify_locations�set_default_verify_paths�HTTPSHandlerrD �_openerr
)
�url�data�timeout�_3to2kwargsrN rO rP rR �
https_handler�openers
�p/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/future/backports/urllib/request.pyrB rB � sU � ��k�!�!�{�;�/G�9�[�Yd�Me�Me��)��;����X�)>��K�PX�DY�DY��&��;����X�)>��K�PX�DY�DY��&�
� �� �9� �� :��8�9�9�9��.��!4�5�5�����3�?�*���!�/���� /�V� /��)�)�&�&�9�9�9�9��,�,�.�.�.�$�W�T�J�J�J�
��m�,�,��� ��'�>�>�)��&�&����;�;�s�D�'�*�*�*� c �
� | a d S �N)r_ )re s rf rC rC � s � ��G�G�Grg c �L � t | � � \ }}t j t | |� � � � 5 }|� � � }|dk r/|s-t
j � |� � |fcddd� � S |rt |d� � }n6t j
d�� � }|j }t �
|� � |5 ||f} d}
d}d}d}
d |v rt |d
� � }|r
||
|
|� � |� |
� � }|sn<|t! |� � z
}|� |� � |
dz
}
|r
||
|
|� � �T ddd� � n# 1 swxY w Y ddd� � n# 1 swxY w Y |dk r||k rt% d
||fz | � � �| S )aW
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-LengthTr �1retrieval incomplete: got only %i out of %i bytes)r �
contextlib�closingrB �info�os�path�normpathr
�tempfile�NamedTemporaryFile�name�_url_tempfiles�appendr �read�len�writer )r` �filename�
reporthookra �url_typerw �fp�headers�tfp�result�bs�sizer~ �blocknum�blocks rf rH rH � s� � � �s�^�^�N�H�d� � �G�C��.�.� /� /� $3�2��'�'�)�)�� �v���h���7�#�#�D�)�)�7�2�
$3� $3� $3� $3� $3� $3� $3� $3� � ,��x��&�&�C�C��-�U�;�;�;�C��x�H��!�!�(�+�+�+�
� 3� 3��w�&�F��B��D��D��H��7�*�*��7�#3�4�5�5���
/��
�8�R��.�.�.�
3��������� ����E�
�
�"��� � �%� � � ��A�
��� 3��J�x��T�2�2�2�
3� � 3� 3� 3� 3� 3� 3� 3� 3� 3� 3� 3���� 3� 3� 3� 3�!$3� $3� $3� $3� $3� $3� $3� $3� $3� $3� $3���� $3� $3� $3� $3�L �q�y�y�T�D�[�[�"�?��T�l�
�"�$� $� $� �Ms= �=E8�?AE8�
B
E!�E8�!E% �%E8�(E% �)E8�8E<�?E<c � � t D ]'} t j | � � �# t $ r Y �$w xY wt d d �= t rd ad S d S ri )r| rv �unlink�EnvironmentErrorr_ )� temp_files rf rI rI � sr � �#� � � � ��I�i� � � � ��� � � ��D� ���� �q�q�q��� ������ s � �
-�-z:\d+$c �� � | j }t |� � d }|dk r| � dd� � }t � d|d� � }|� � � S )z�Return request-host, as defined by RFC 2965.
Variation from RFC: returned value is lowercased, for convenient
comparison.
r � �Host)�full_urlr �
get_header�_cut_port_re�sub�lower)�requestr` �hosts rf �request_hostr� sa � � �
�C��C�=�=���D��r�z�z��!�!�&�"�-�-�� ���B��a�(�(�D��:�:�<�<�rg c � � e Zd Zdi dddfd�Zd� Zd� Zd� Zd� Zd� Zd � Z d
� Z
d� Zd� Zd
� Z
d� Zd� Zd� Zd� Zd� Zd� Zdd�Zd� ZdS )r- NFc �| � t |� � | _ t | j � � \ | _ | _ || _ i | _ d | _ |� � � D ]\ }}| � ||� � �i | _ |�t | � � }|| _ || _ || _
| � � � d S ri )r r� r&