zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
U
 ý°d¯ã    @s’UddlmZddlZddlZddlmZddlmZddlm    Z    ddl
m Z ej r`dd    l mZd
Zed d d gƒZdZz.z ddlZWnek
r ddlZYnXWnek
r¸Yn
Xed7Zz ddlZWnek
râYn
Xed7ZGdd„deƒZejZded<ejeefZddddddhZ d5ddddddddœd d!„Z!d"d#d#d$œd%d&„Z"d'd(d)d*œd+d,„Z#Gd-d.„d.ej$ƒZ%d/d0d1d.d2œd3d4„Z&dS)6é)Ú annotationsN)Ú    b64encode)ÚEnumé)ÚUnrewindableBodyErroré)Úto_bytes)ÚFinalz@@@SKIP_HEADER@@@úaccept-encodingÚhostú
user-agentz gzip,deflatez,brz,zstdc@seZdZdZdS)Ú_TYPE_FAILEDTELLrN)Ú__name__Ú
__module__Ú __qualname__Útoken©rrúKd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\urllib3/util/request.pyr 'sr zFinal[_TYPE_FAILEDTELL]Ú _FAILEDTELLÚGETÚHEADÚDELETEÚTRACEÚOPTIONSZCONNECTz bool | Nonezbool | list[str] | str | Nonez
str | Nonezdict[str, str])Ú
keep_aliveÚaccept_encodingÚ
user_agentÚ
basic_authÚproxy_basic_authÚ disable_cacheÚreturncCsži}|r6t|tƒrnt|tƒr*d |¡}nt}||d<|rB||d<|rNd|d<|rndt| d¡ƒ ¡›|d<|rŽdt| d¡ƒ ¡›|d    <|ršd
|d <|S) aÎ
    Shortcuts for generating request headers.
 
    :param keep_alive:
        If ``True``, adds 'connection: keep-alive' header.
 
    :param accept_encoding:
        Can be a boolean, list, or string.
        ``True`` translates to 'gzip,deflate'.  If either the ``brotli`` or
        ``brotlicffi`` package is installed 'gzip,deflate,br' is used instead.
        List will get joined by comma.
        String will be used as provided.
 
    :param user_agent:
        String representing the user-agent you want, such as
        "python-urllib3/0.6"
 
    :param basic_auth:
        Colon-separated username:password string for 'authorization: basic ...'
        auth header.
 
    :param proxy_basic_auth:
        Colon-separated username:password string for 'proxy-authorization: basic ...'
        auth header.
 
    :param disable_cache:
        If ``True``, adds 'cache-control: no-cache' header.
 
    Example:
 
    .. code-block:: python
 
        import urllib3
 
        print(urllib3.util.make_headers(keep_alive=True, user_agent="Batman/1.0"))
        # {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'}
        print(urllib3.util.make_headers(accept_encoding=True))
        # {'accept-encoding': 'gzip,deflate'}
    ú,r
r z
keep-aliveÚ
connectionzBasic zlatin-1Ú authorizationzproxy-authorizationzno-cachez cache-control)Ú
isinstanceÚstrÚlistÚjoinÚACCEPT_ENCODINGrÚencodeÚdecode)rrrrrrÚheadersrrrÚ make_headers7s2/
 
 þÿþÿr,z
typing.Anyz_TYPE_BODY_POSITION | None)ÚbodyÚposr cCsN|dk    rt||ƒn6t|ddƒdk    rJz | ¡}Wntk
rHt}YnX|S)z
    If a position is provided, move file to that point.
    Otherwise, we'll attempt to record a position for future use.
    NÚtell)Ú rewind_bodyÚgetattrr/ÚOSErrorr)r-r.rrrÚset_file_position†s  
r3ztyping.IO[typing.AnyStr]Ú_TYPE_BODY_POSITIONÚNone)r-Úbody_posr c
Cs„t|ddƒ}|dk    rZt|tƒrZz ||ƒWq€tk
rV}ztdƒ|‚W5d}~XYq€Xn&|tkrltdƒ‚ntdt|ƒ›dƒ‚dS)zæ
    Attempt to rewind body to a certain position.
    Primarily used for request redirects and retries.
 
    :param body:
        File-like object that supports seek.
 
    :param int pos:
        Position to seek to in file.
    ÚseekNzAAn error occurred when rewinding request body for redirect/retry.zRUnable to record file position for rewinding request body during a redirect/retry.z1body_pos must be of type integer, instead it was Ú.)r1r$Úintr2rrÚ
ValueErrorÚtype)r-r6Ú    body_seekÚerrrr0šs"  ÿþÿÿr0c@seZdZUded<ded<dS)ÚChunksAndContentLengthztyping.Iterable[bytes] | NoneÚchunksz
int | NoneÚcontent_lengthN)rrrÚ__annotations__rrrrr>¸s
r>ztyping.Any | Noner%r9)r-ÚmethodÚ    blocksizer c säˆdkr$d}| ¡tkrd}qØd}n´tˆttfƒrJtˆƒf}t|dƒ}nŽtˆdƒrtddœ‡‡fdd„ }|ƒ}d}ndz tˆƒ}WnJt    k
rÊzt
ˆƒ}d}Wn$t    k
rÄt    dˆ›ƒd‚YnXYnXˆf}|j }t ||d    S)
aRTakes the HTTP request method, body, and blocksize and
    transforms them into an iterable of chunks to pass to
    socket.sendall() and an optional 'Content-Length' header.
 
    A 'Content-Length' of 'None' indicates the length of the body
    can't be determined so should use 'Transfer-Encoding: chunked'
    for framing instead.
    NrÚreadztyping.Iterable[bytes])r c3s6tˆtjƒ}ˆ ˆ¡}|sq2|r*| d¡}|Vq dS)Nz
iso-8859-1)r$ÚioÚ
TextIOBaserDr))r)Ú    datablock©rCr-rrÚchunk_readableÞs 
 
z&body_to_chunks.<locals>.chunk_readablezO'body' must be a bytes-like object, file-like object, or iterable. Instead was )r?r@) ÚupperÚ_METHODS_NOT_EXPECTING_BODYr$r%ÚbytesrÚlenÚhasattrÚ
memoryviewÚ    TypeErrorÚiterÚnbytesr>)r-rBrCr?r@rIÚmvrrHrÚbody_to_chunks½s6 
 
  ÿýrT)NNNNNN)'Ú
__future__rrEÚtypingÚbase64rÚenumrÚ
exceptionsrÚutilrÚ TYPE_CHECKINGZtyping_extensionsr    Z SKIP_HEADERÚ    frozensetZSKIPPABLE_HEADERSr(Z
brotlicffiZ_unused_module_brotliÚ ImportErrorÚbrotliZ    zstandardZ_unused_module_zstdr rrrAÚUnionr9r4rKr,r3r0Ú
NamedTupler>rTrrrrÚ<module>sP        úO