HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/httpx/_transports/__pycache__/default.cpython-310.pyc
o

���g�6�@s�UdZddlmZddlZddlZddlmZejr"ddlZddl	Z	ddl
mZmZm
Z
mZddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlmZm Z dd	l!m"Z"m#Z#m$Z$m%Z%dd
l&m'Z'ddl(m)Z)m*Z*ej+d
dd�Z,ej+ddd�Z-ej.ej/e0e0e0fej/e0e0ej.e1e2ffej/e0e0de0ffZ3ddgZ4ia5de6d<d dd�Z7ej8d!dd��Z9Gdd�de%�Z:Gdd�de*�Z;Gdd�de"�Z<Gdd�de)�Z=dS)"a�
Custom transports, with nicely configured defaults.

The following additional keyword arguments are currently supported by httpcore...

* uds: str
* local_address: str
* retries: int

Example usages...

# Disable HTTP/2 on a single specific domain.
mounts = {
    "all://": httpx.HTTPTransport(http2=True),
    "all://*example.org": httpx.HTTPTransport()
}

# Using advanced httpcore configuration, with connection retries.
transport = httpx.HTTPTransport(retries=1)
client = httpx.Client(transport=transport)

# Using advanced httpcore configuration, with unix domain sockets.
transport = httpx.HTTPTransport(uds="socket.uds")
client = httpx.Client(transport=transport)
�)�annotationsN)�
TracebackType�)�DEFAULT_LIMITS�Limits�Proxy�create_ssl_context)�ConnectError�ConnectTimeout�LocalProtocolError�NetworkError�PoolTimeout�
ProtocolError�
ProxyError�	ReadError�ReadTimeout�RemoteProtocolError�TimeoutException�UnsupportedProtocol�
WriteError�WriteTimeout)�Request�Response)�AsyncByteStream�	CertTypes�
ProxyTypes�SyncByteStream)�URL�)�AsyncBaseTransport�
BaseTransport�T�
HTTPTransport)�bound�A�AsyncHTTPTransport�,dict[type[Exception], type[httpx.HTTPError]]�HTTPCORE_EXC_MAP�returncCs`ddl}|jt|jt|jt|jt|jt|jt|jt|jt|j	t	|j
t
|jt|jt|j
t
|jtiS�Nr)�httpcorerr
rrr
rr	rrrrrrr)r*�r+�D/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py�_load_httpcore_exceptionsJs �r-�typing.Iterator[None]c
cs��tt�dkr
t�azdVWdStyF}z*d}t��D]\}}t||�s(q|dus1t||�r3|}q|dur9�t|�}||�|�d}~wwr))�lenr'r-�	Exception�items�
isinstance�
issubclass�str)�exc�
mapped_exc�from_exc�to_exc�messager+r+r,�map_httpcore_exceptions_s&�
�
��r:c@�*eZdZd
dd�Zddd	�Zdd
d�ZdS)�ResponseStream�httpcore_stream�typing.Iterable[bytes]r(�NonecC�
||_dS�N��_httpcore_stream��selfr=r+r+r,�__init__z�
zResponseStream.__init__�typing.Iterator[bytes]ccs@�t��|jD]}|VqWd�dS1swYdSrA�r:rC�rE�partr+r+r,�__iter__}s�
�"�zResponseStream.__iter__cCst|jd�r
|j��dSdS)N�close)�hasattrrCrM�rEr+r+r,rM�s�zResponseStream.closeN)r=r>r(r?)r(rH�r(r?)�__name__�
__module__�__qualname__rFrLrMr+r+r+r,r<y�

r<c@�^eZdZdddddedddddfd/dd�Zd0dd�Z			d1d2d&d'�Zd3d+d,�Zd4d-d.�ZdS)5r"TNFr�verify�ssl.SSLContext | str | bool�cert�CertTypes | None�	trust_env�bool�http1�http2�limitsr�proxy�ProxyTypes | None�uds�
str | None�
local_address�retries�int�socket_options�%typing.Iterable[SOCKET_OPTION] | Noner(r?c
CsNddl}t|ttf�rt|d�n|}t|||d�}
|dur2|j|
|j|j|j	||||	|
|d�
|_
dS|jjdvra|j
|j|jj|jj|jj|jjd�|j|jj|
|j|j|j|j	|||d�|_
dS|jjdvr�zddl}Wntyytd	�d�w|j|j|jj|jj|jj|jjd�|j|
|j|j|j	||d
�|_
dStd|jj�d���)
Nr��url�rVrXrZ�
�ssl_context�max_connections�max_keepalive_connections�keepalive_expiryr\r]rarcrdrf��http�https��scheme�host�port�target)�	proxy_url�
proxy_auth�
proxy_headersrl�proxy_ssl_contextrmrnror\r]rf��socks5�socks5h�{Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`.�rxryrlrmrnror\r]zOProxy protocol must be either 'http', 'https', 'socks5', or 'socks5h', but got �.)r*r2r4rrr�ConnectionPoolrmrnro�_poolrirt�	HTTPProxy�
raw_scheme�raw_hostrv�raw_path�raw_auth�headers�rawrl�socksio�ImportError�
SOCKSProxy�
ValueError�rErVrXrZr\r]r^r_rarcrdrfr*rlr�r+r+r,rF�s�����������zHTTPTransport.__init__rEr!cCs|j��|SrA)r��	__enter__rOr+r+r,r��s
zHTTPTransport.__enter__�exc_type�type[BaseException] | None�	exc_value�BaseException | None�	traceback�TracebackType | NonecCs<t��|j�|||�Wd�dS1swYdSrA)r:r��__exit__�rEr�r�r�r+r+r,r��s"�zHTTPTransport.__exit__�requestrrcCs�t|jt�sJ�ddl}|j|j|j|jj|jj	|jj
|jjd�|jj
|j|jd�}t��|j�|�}Wd�n1s>wYt|jtj�sLJ�t|j|jt|j�|jd�S�Nrrs)�methodrir��content�
extensions)�status_coder��streamr�)r2r�rr*rr�rrir�r�rvr�r�r�r�r:r��handle_request�typing�Iterabler�statusr<�rEr�r*�req�respr+r+r,r��s0����zHTTPTransport.handle_requestcCs|j��dSrA)r�rMrOr+r+r,rMszHTTPTransport.close�rVrWrXrYrZr[r\r[r]r[r^rr_r`rarbrcrbrdrerfrgr(r?)rEr!r(r!�NNN�r�r�r�r�r�r�r(r?�r�rr(rrP)	rQrRrSrrFr�r�r�rMr+r+r+r,r"��(�
Q�
	c@r;)�AsyncResponseStreamr=�typing.AsyncIterable[bytes]r(r?cCr@rArBrDr+r+r,rF
rGzAsyncResponseStream.__init__�typing.AsyncIterator[bytes]cCsJ�t��|j2z	3dHW}|Vq6Wd�dS1swYdSrArIrJr+r+r,�	__aiter__
s��"�zAsyncResponseStream.__aiter__c�s&�t|jd�r|j��IdHdSdS)N�aclose)rNrCr�rOr+r+r,r�s��zAsyncResponseStream.acloseN)r=r�r(r?)r(r�rP)rQrRrSrFr�r�r+r+r+r,r�	rTr�c@rU)5r%TNFrrVrWrXrYrZr[r\r]r^rr_r`rarbrcrdrerfrgr(r?c
CsBddl}t|ttf�rt|d�n|}t|||d�}
|dur2|j|
|j|j|j	||||	|
|d�
|_
dS|jjdvra|j
|j|jj|jj|jj|jjd�|j|jj|j|
|j|j|j	|||d�|_
dS|jjdvr�zddl}Wntyytd	�d�w|j|j|jj|jj|jj|jjd�|j|
|j|j|j	||d
�|_
dStd��)Nrrhrjrkrprs)rxryrzr{rlrmrnror\r]rfr|rr�zdProxy protocol must be either 'http', 'https', 'socks5', or 'socks5h', but got {proxy.url.scheme!r}.)r*r2r4rrr�AsyncConnectionPoolrmrnror�rirt�AsyncHTTPProxyr�r�rvr�r�r�r�rlr�r��AsyncSOCKSProxyr�r�r+r+r,rFs~���������zAsyncHTTPTransport.__init__rEr$c�s�|j��IdH|SrA)r��
__aenter__rOr+r+r,r�is�zAsyncHTTPTransport.__aenter__r�r�r�r�r�r�c�sD�t��|j�|||�IdHWd�dS1swYdSrA)r:r��	__aexit__r�r+r+r,r�ms�"�zAsyncHTTPTransport.__aexit__r�rrc�s��t|jt�s	J�ddl}|j|j|j|jj|jj	|jj
|jjd�|jj
|j|jd�}t��|j�|�IdH}Wd�n1sBwYt|jtj�sPJ�t|j|jt|j�|jd�Sr�)r2r�rr*rr�rrir�r�rvr�r�r�r�r:r��handle_async_requestr��
AsyncIterablerr�r�r�r+r+r,r�vs2�����z'AsyncHTTPTransport.handle_async_requestc�s�|j��IdHdSrA)r�r�rOr+r+r,r��s�zAsyncHTTPTransport.acloser�)rEr$r(r$r�r�r�rP)	rQrRrSrrFr�r�r�r�r+r+r+r,r%r�)r(r&)r(r.)>�__doc__�
__future__r�
contextlibr��typesr�
TYPE_CHECKING�ssl�httpx�_configrrrr�_exceptionsr	r
rrr
rrrrrrrrr�_modelsrr�_typesrrrr�_urlsr�baserr �TypeVarr!r$�Union�Tuplere�bytes�	bytearray�
SOCKET_OPTION�__all__r'�__annotations__r-�contextmanagerr:r<r"r�r%r+r+r+r,�<module>s@@��