o
ail @ s d Z ddlZddlZddlZddlmZ ddlmZ ddl m
Z
ddlmZm
Z
mZmZ ddlmZ dd lmZ dd
lmZ ddlmZ ddlmZmZmZ dd
lmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ ddl%m&Z&m'Z' ddl(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2 ddl3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>m?Z? ddl3m@ZA ddlBmCZC eCjDeCjEeCjFeCjGeCjHfZIdZJdZKdZLG dd deMZNG dd deMZOG dd deOZPG dd deNeOZQG dd deMZRdS ) z`
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
N)RequestField)encode_multipart_formdata) parse_url)DecodeErrorReadTimeoutError
ProtocolErrorLocationParseError)UnsupportedOperation )
default_hooks)CaseInsensitiveDict)
HTTPBasicAuth)cookiejar_from_dictget_cookie_header_copy_cookie_jar) HTTPError
MissingSchema
InvalidURLChunkedEncodingErrorContentDecodingErrorConnectionErrorStreamConsumedErrorInvalidJSONError)to_native_stringunicode_is_ascii)
guess_filenameget_auth_from_urlrequote_uristream_decode_response_unicodeto_key_val_listparse_header_linksiter_slicesguess_json_utf super_lencheck_header_validity)CallableMapping cookielib
urlunparseurlsplit urlencodestrbytesis_py2chardetbuiltin_str
basestring)json)codes i ( i c @ s0 e Zd Zedd Zedd Zedd ZdS )RequestEncodingMixinc C sN g }t | j}|j}|sd}|| |j}|r"|d || d|S )zBuild the path URL to use./? )r) urlpathappendqueryjoin)selfr8 pr9 r; r? /builddir/build/BUILDROOT/alt-python310-pip-21.3.1-5.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_vendor/requests/models.pypath_url= s
zRequestEncodingMixin.path_urlc C s t | ttfr | S t| dr| S t| drWg }t| D ]5\}}t |ts)t|ds,|g}|D ]!}|durO|t |tr@|dn|t |trK|dn|f q.qt|ddS | S )zEncode parameters in a piece of data.
Will successfully encode parameters when passed as a dict or a list of
2-tuples. Order is retained if data is a list of 2-tuples but arbitrary
if parameters are supplied as a dict.
read__iter__Nutf-8T)doseq)
isinstancer+ r, hasattrr r0 r: encoder* )dataresultkvsvr? r? r@ _encode_paramsR s(
z#RequestEncodingMixin._encode_paramsc C s | st dt|trt dg }t|pi }t| pi } |D ]>\}}t|ts-t|ds0|g}|D ]*}|dur\t|tsAt|}|t|trM|dn|t|trX| dn|f q2q| D ]d\}}d}d} t|t
tfrt|dkrz|\}
}nt|dkr|\}
}}n|\}
}}} nt
|p|}
|}t|tttfr|}nt|dr| }n|du rq`|}t|||
| d }
|
j|d
||
q`t|\}}||fS )a Build the body for a multipart/form-data request.
Will successfully encode files when passed as a dict or a list of
tuples. Order is retained if data is a list of tuples but arbitrary
if parameters are supplied as a dict.
The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype)
or 4-tuples (filename, fileobj, contentype, custom_headers).
zFiles must be provided.zData must not be a string.rC NrD rB )namerI filenameheaders)content_type)
ValueErrorrF r0 r rG r, r+ r: decoderH tuplelistlenr bytearrayrB r make_multipartr )filesrI
new_fieldsfieldsfieldvalrM rK ftfhfnfpfdatarfbodyrT r? r? r@
_encode_filesm sX
z"RequestEncodingMixin._encode_filesN)__name__
__module____qualname__propertyrA staticmethodrN rh r? r? r? r@ r4 <