Format: application/x-python-code
1 o
2
3 C'h
4 = � @ s$ d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dl Zd dl
5 Zd dlZd dl
6 Zd dlZd dlZddlmZ ddlmZ ddlmZ ddlmZ ejrUd dlZd�d
7 d�Zd�dd�Zd�d�dd�Zd�d d!�Zd�d�d"d#�Zd�d$d%�Zd�d&d'�Z ej!ej!e"e"f d(f Z#ej!e#d(f Z$ej%e"ej&e"e$e#f f Z'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�Nonec C sT t j�� } | jddd� | �� | jddd� | �� | jddd� | �� t jjjddd �}|jd
8 dddd� |�d
9 � |�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/� | �|� d S )0Nz[bold]HTTPX :butterfly:�center)�justifyzA next generation HTTP client.z7Usage: [bold]httpx[/bold] [cyan]<URL> [OPTIONS][/cyan] �leftr T)�padding�pad_edge� Parameter�bold)�no_wrapr �style�Descriptionz-m, --method [cyan]METHODz{Request method, such as GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD.
10 [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
11 -v, --verbosez1Verbose output. Show request as well as response.�--help�Show this message and exit.) �rich�console�Console�print�table�Table�grid�
12 add_column�add_row)r( r+ � r0 �AC:\Users\shubh\Videos\agent\nova\Lib\site-packages\httpx/_main.py�
13 print_help s|
14 �
15 ������������r2 �responser �strc C s^ | j �d�}|d ur-|�d�\}}}zt�ttj�|� � �j
16 �W S tjjy, Y dS w dS )NzContent-Type�;� )
17 �headers�get� partition�typing�castr4 �pygments�lexers�get_lexer_for_mimetype�strip�name�util�
18 ClassNotFound)r3 �content_typeZ mime_type�_r0 r0 r1 �get_lexer_for_responseg s ��rE F�request�httpcore.Request�http2�boolc sh � rdnd}� fdd�| j D �}| j�d�}| jj�d�}|� d|� d|� �gdd� |D � }d�|�S ) NzHTTP/2zHTTP/1.1c s$ g | ]\}}� r|� � n||f�qS r0 )�lower��.0r@ �value�rH r0 r1 �
19 <listcomp>v s �z*format_request_headers.<locals>.<listcomp>�ascii� c S �* g | ]\}}|� d �� d|� d �� ��qS �rP �: ��decoderK r0 r0 r1 rO { � ��
20 )r7 �methodrV �url�target�join)rF rH �versionr7 rY r[ �linesr0 rN r1 �format_request_headerst s
21 ��
22 r_ �http_version�bytes�status�int�
23 reason_phrase�bytes | Noner7 �list[tuple[bytes, bytes]]c C sT | � d�}|d u rt�|�n|� d�}|� d|� d|� �gdd� |D � }d�|�S )NrP rQ c S rR rS rU rK r0 r0 r1 rO � rW z+format_response_headers.<locals>.<listcomp>rX )rV r Zget_reason_phraser\ )r` rb rd r7 r] �reasonr^ r0 r0 r1 �format_response_headers� s
24
25 ���
26 rh c C sV t j�� }t| |d�}t jj|dddd�}|�|� t jjddddd�}|�|� d S )NrN �http� ansi_darkT��theme� word_wrapr6 )r'