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: //home/arjun/.local/lib/python3.10/site-packages/httpx/__pycache__/_main.cpython-310.pyc
o

���g
=�@s$ddlmZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlZddl
ZddlZddlZddlmZddlmZddlmZddlmZejrUddlZd�d
d�Zd�dd�Zd�d�dd�Zd�d d!�Zd�d�d"d#�Zd�d$d%�Zd�d&d'�Z ej!ej!e"e"fd(fZ#ej!e#d(fZ$ej%e"ej&e"e$e#ffZ'd�d+d,�Z(	d�d�d1d2�Z)d�d5d6�Z*d�d=d>�Z+d�d?d@�Z,d�dAdB�Z-ej.ddC�ej/dDe"dE�ej0dFdGdHe"dIdJ�ej0dKdLdMe"e"fdNdOdP�ej0dQdRdSe"dTdJ�ej0dUdVdWe"e"fdNdXdP�ej0dYdZd[e"ej1d\d]�fdNd^dP�ej0d_d`dae"e+dbdc�ej0dddede"e"fdNdfdP�ej0dgdhe"e"fdNdidP�ej0djdke"e"fdle,dmdn�ej0dodpe"ddqdr�ej0dsdte2dudvdr�ej0dwdxdNddydz�ej0d{d|dNdNd}dz�ej0d~de3dNddd��ej0d�e�1d��d�dJ�ej0d�d�e3dNdd�d��ej0d�dNdNde-d�d��d�d�d���������������������Z4dS)��)�annotationsN�)�Client)�RequestError)�Response)�codes�return�NonecCsTtj��}|jddd�|��|jddd�|��|jddd�|��tjjjddd	�}|jd
dddd�|�d
�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�dd�|�d d!�|�d"d#�|�d$d%�|�d&d'�|�d(d)�|�d*d+�|�d,d-�|�d.d/�|�|�dS)0Nz[bold]HTTPX :butterfly:�center)�justifyzA next generation HTTP client.z7Usage: [bold]httpx[/bold] [cyan]<URL> [OPTIONS][/cyan] �leftrT)�padding�pad_edge�	Parameter�bold)�no_wrapr�style�Descriptionz-m, --method [cyan]METHODz{Request method, such as GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD.
[Default: GET, or POST if a request body is included]z#-p, --params [cyan]<NAME VALUE> ...�/Query parameters to include in the request URL.z-c, --content [cyan]TEXT�,Byte content to include in the request body.z!-d, --data [cyan]<NAME VALUE> ...�)Form data to include in the request body.z%-f, --files [cyan]<NAME FILENAME> ...�*Form files to include in the request body.z-j, --json [cyan]TEXT�)JSON data to include in the request body.z$-h, --headers [cyan]<NAME VALUE> ...�/Include additional HTTP headers in the request.z --cookies [cyan]<NAME VALUE> ...�"Cookies to include in the request.z--auth [cyan]<USER PASS>��Username and password to include in the request. Specify '-' for the password to use a password prompt. Note that using --verbose/-v will expose the Authorization header, including the password encoding in a trivially reversible format.z--proxy [cyan]URL�ISend the request via a proxy. Should be the URL giving the proxy address.z--timeout [cyan]FLOAT�zTimeout value to use for network operations, such as establishing the connection, reading some data, etc... [Default: 5.0]�--follow-redirects�Automatically follow redirects.�--no-verify�Disable SSL verification.�--http2�@Send the request using HTTP/2, if the remote server supports it.z--download [cyan]FILE�?Save the response content as a file, rather than displaying it.z
-v, --verbosez1Verbose output. Show request as well as response.�--help�Show this message and exit.)	�rich�console�Console�print�table�Table�grid�
add_column�add_row)r(r+�r0�>/home/arjun/.local/lib/python3.10/site-packages/httpx/_main.py�
print_helps|
�
������������r2�responser�strcCs^|j�d�}|dur-|�d�\}}}zt�ttj�|�	��j
�WStjjy,YdSwdS)NzContent-Type�;�)
�headers�get�	partition�typing�castr4�pygments�lexers�get_lexer_for_mimetype�strip�name�util�
ClassNotFound)r3�content_type�	mime_type�_r0r0r1�get_lexer_for_responsegs��rFF�request�httpcore.Request�http2�boolcsh�rdnd}�fdd�|jD�}|j�d�}|jj�d�}|�d|�d|��gdd�|D�}d�|�S)	NzHTTP/2zHTTP/1.1cs$g|]\}}�r|��n||f�qSr0)�lower��.0r@�value�rIr0r1�
<listcomp>vs�z*format_request_headers.<locals>.<listcomp>�ascii� cS�*g|]\}}|�d��d|�d����qS�rQ�: ��decoderLr0r0r1rP{���
)r7�methodrW�url�target�join)rGrI�versionr7rZr\�linesr0rOr1�format_request_headersts
��
r`�http_version�bytes�status�int�
reason_phrase�bytes | Noner7�list[tuple[bytes, bytes]]cCsT|�d�}|durt�|�n|�d�}|�d|�d|��gdd�|D�}d�|�S)NrQrRcSrSrTrVrLr0r0r1rP�rXz+format_response_headers.<locals>.<listcomp>rY)rWr�get_reason_phraser])rarcrer7r^�reasonr_r0r0r1�format_response_headers�s

���
rjcCsVtj��}t||d�}tjj|dddd�}|�|�tjjddddd�}|�|�dS)NrO�http�	ansi_darkT��theme�	word_wrapr6)r'r(r)r`�syntax�Syntaxr*)rGrIr(�	http_textrpr0r0r1�print_request_headers�s

rscCsXtj��}t||||�}tjj|dddd�}|�|�tjjddddd�}|�|�dS)NrkrlTrmr6)r'r(r)rjrprqr*)rarcrer7r(rrrpr0r0r1�print_response_headers�s

rtcCs�tj��}t|�}|r?|��dkr+z
|��}tj|dd�}Wnty*|j}Ynw|j}tj	j
||ddd�}|�|�dS|�dt|j
��d��dS)	N�json�)�indentrlTrm�<z bytes of binary data>)r'r(r)rFrKru�dumps�
ValueError�textrprqr*�len�content)r3r(�
lexer_name�datar{rpr0r0r1�print_response�s

�r�.�cert�_PeerCertRetDictTypec
Cs�g}|��D]a\}}t|ttf�r\|�d|�d��|D]>}|dvr7|D]}|�d|d�d|d���q$qt|t�rRt|�dkrR|�d|d�d|d���q|�d|���qq|�d|�d|���qd	�|�S)
Nz*   �:)�subject�issuerz*     rrUr�rY)�items�
isinstance�list�tuple�appendr|r])r�r_�keyrN�item�sub_itemr0r0r1�format_certificate�s � �	
r�r@�info�typing.Mapping[str, typing.Any]�verbosecCs�tj��}|dkr|r|d}|�d|���dS|dkr9|r9|d}|�d�}|�d|d�d	|d
���dS|dkr|r|d}|�d�}|��}|��}	|��}
|��}|�d
|�d|	d���|�d|���|
r}|�d�|�t	|
��dSdS|dkr�|r�|d}t
|dd�dS|dkr�|r�|d}t
|dd�dS|dkr�|d\}
}}}t|
|||�dS|dkr�|d\}}d}
d}t|
|||�dSdS)Nzconnection.connect_tcp.started�hostz* Connecting to zconnection.connect_tcp.complete�return_value�server_addrz* Connected to rz	 on port rzconnection.start_tls.complete�
ssl_objectz* SSL established using z / z* Selected ALPN protocol: z* Server certificate:z#http11.send_request_headers.startedrGFrOz"http2.send_request_headers.startedTz(http11.receive_response_headers.completez'http2.receive_response_headers.completesHTTP/2)r'r(r)r*�get_extra_infor^�cipher�getpeercert�selected_alpn_protocolr�rsrt)r@r�r�r(r��streamr�r�r^r��server_cert�alpnrGrarcrer7r0r0r1�trace�sH

"

��r��download�typing.BinaryIOcCs�tj��}|��|j�d�}tj�ddtjjdd�tj�	�tj�
���5}dtj�|j
���}|j|t|p6d�|dud�}|��D]}|�|�|j||jd�qAWd�dS1s\wYdS)	NzContent-Lengthz([progress.description]{task.description}z-[progress.percentage]{task.percentage:>3.0f}%)�	bar_widthzDownloading [bold]r)�total�start)�	completed)r'r(r)r*r7r8�progress�Progress�	BarColumn�DownloadColumn�TransferSpeedColumn�markup�escaper@�add_taskrd�
iter_bytes�write�update�num_bytes_downloaded)r3r�r(�content_lengthr��description�
download_task�chunkr0r0r1�download_response�s,
�
�
�"�r��ctx�
click.Context�param�click.Option | click.ParameterrN�
typing.AnycCs4|durdSzt�|�WStjyt�d��w)NzNot valid JSON)ru�loads�JSONDecodeError�click�BadParameter�r�r�rNr0r0r1�
validate_jsons
�r�cCs2|dkrdS|\}}|dkrtjddd�}||fS)N�NN�-�PasswordT)�
hide_input)r��prompt)r�r�rN�username�passwordr0r0r1�
validate_authsr�cCs |r|jrdSt�|��dS)N)�resilient_parsingr2�exitr�r0r0r1�handle_help-s
r�)�add_help_optionr[)�typez--methodz-mrZz{Request method, such as GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD. [Default: GET, or POST if a request body is included])r��helpz--paramsz-p�paramsTr)r��multipler�z	--contentz-cr}rz--dataz-drrz--filesz-f�files�rb)�moderz--jsonz-jrur)r��callbackr�z	--headersz-hrz	--cookies�cookiesrz--auth�authr�r)r��defaultr�r�z--proxy�proxyr)r�r�r�z	--timeout�timeoutg@rr�follow_redirectsr)�is_flagr�r�r �verifyr!r"r#)r�r�r�r�z
--download�wbr$z	--verbosez-vz*Verbose. Show request as well as response.r%r&)r��is_eager�expose_valuer�r��list[tuple[str, str]]�list[tuple[str, click.File]]�tuple[str, str] | None�float�typing.BinaryIO | NonecCsJ|s|s
|s
|s
|rdnd}z]t|
|||
d��K}|j||t|�|t|�|||t|�|	|dtjt|d�id��}|durAt||�n|��|j	rLt
|�Wd�n1sVwYWd�n1sewYWn*ty�}ztj
��}|�dt|�j�d	|���t�d
�WYd}~nd}~wwt�|jr�d�dSd
�dS)zU
    An HTTP command line client.
    Sends a request and displays the response.
    �POST�GET)r�r�rIr�r�)r�)
r�r}rr�rur7r�r�r��
extensionsNz[red]z[/red]: rr)rr�r��dict�	functools�partialr�r��readr}r�rr'r(r)r*r��__name__�sysr��
is_success)r[rZr�r}rr�rur7r�r�r�r�r�r�rIr�r��clientr3�excr(r0r0r1�main9sJ#�
�����
��r�)rr	)r3rrr4)F)rGrHrIrJrr4)
rarbrcrdrerfr7rgrr4)rGrHrIrJrr	)
rarbrcrdrerfr7rgrr	)r3rrr	)r�r�rr4)r@r4r�r�r�rJrr	)r3rr�r�rr	)r�r�r�r�rNr�rr�)r�r�r�r�rNr�rr	)$r[r4rZr4r�r�r}r4rr�r�r�rur4r7r�r�r�r�r�r�r4r�r�r�rJr�rJrIrJr�r�r�rJrr	)5�
__future__rr�rur�r:r��pygments.lexersr<�
pygments.util�rich.consoler'�rich.markup�
rich.progress�rich.syntax�
rich.table�_clientr�_exceptionsr�_modelsr�
_status_codesr�
TYPE_CHECKING�httpcorer2rFr`rjrsrtr��Tupler4�_PCTRTT�_PCTRTTT�Dict�Unionr�r�r�r�r�r�r��command�argument�option�Filer�rJr�r0r0r0r1�<module>sJ

M


	

�
'



�
��������
��
������4