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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
U
 ý°dz›ã
@sšddlmZddlZddlZddlZddlZddlZddlZddl    Z    ddl
Z
ddl Z ddl m Z ddlmZddlmZddlmZz.z ddlZWnek
r®ddlZYnXWnek
rÊdZYnXz:ddlZeeee dej¡  ¡ƒƒZ!Z!e!dkrdZWn e"ee#fk
r&dZYnXd    d
l$m%Z%d    d l&m'Z'd    d l(m)Z)d    d l*m+Z+m,Z,m-Z-d    dl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8d    dl9m:Z:m;Z;d    dl<m=Z=e    j>rÌddl?m@Z@d    dlAmBZBe CeD¡ZEGdd„dƒZFGdd„deFƒZGGdd„dƒZHGdd„deFƒZIedk    r,Gdd„deFƒZJedk    rFGdd„deFƒZKGdd „d eFƒZLd!dd"œd#d$„ZMGd%d&„d&ƒZNGd'd(„d(ejOƒZPGd)d*„d*ePƒZdS)+é)Ú annotationsN)Úcontextmanager)Ú HTTPMessage)Ú HTTPResponse)Útimeoutz^([0-9]+)\.([0-9]+))réé)Úutil)Ú
_TYPE_BODY)ÚHTTPHeaderDict)Ú BaseSSLErrorÚHTTPConnectionÚ HTTPException)
ÚBodyNotHttplibCompatibleÚ DecodeErrorÚ    HTTPErrorÚIncompleteReadÚInvalidChunkLengthÚ InvalidHeaderÚ ProtocolErrorÚReadTimeoutErrorÚResponseNotChunkedÚSSLError)Ú is_fp_closedÚis_response_to_head)ÚRetry)ÚLiteral)ÚHTTPConnectionPoolc@s*eZdZdddœdd„Zddœdd„ZdS)    ÚContentDecoderÚbytes©ÚdataÚreturncCs
tƒ‚dS©N©ÚNotImplementedError©Úselfr!©r(úGd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\urllib3/response.pyÚ
decompressEszContentDecoder.decompress©r"cCs
tƒ‚dSr#r$©r'r(r(r)ÚflushHszContentDecoder.flushN)Ú__name__Ú
__module__Ú __qualname__r*r-r(r(r(r)rDsrc@s8eZdZddœdd„Zdddœdd„Zddœd    d
„Zd S) ÚDeflateDecoderÚNoner+cCsd|_d|_t ¡|_dS)NTó)Ú
_first_tryÚ_dataÚzlibÚ decompressobjÚ_objr,r(r(r)Ú__init__MszDeflateDecoder.__init__rr c Csš|s|S|js|j |¡S|j|7_z"|j |¡}|rFd|_d|_|WStjk
r”d|_t tj ¡|_z| |j¡W¢YSd|_XYnXdS)NF)r4r8r*r5r6Úerrorr7Ú    MAX_WBITS)r'r!Ú decompressedr(r(r)r*Rs"  zDeflateDecoder.decompresscCs
|j ¡Sr#©r8r-r,r(r(r)r-hszDeflateDecoder.flushN©r.r/r0r9r*r-r(r(r(r)r1Lsr1c@seZdZdZdZdZdS)ÚGzipDecoderStaterréN)r.r/r0Ú FIRST_MEMBERÚ OTHER_MEMBERSÚ SWALLOW_DATAr(r(r(r)r?lsr?c@s8eZdZddœdd„Zdddœdd„Zddœd    d
„Zd S) Ú GzipDecoderr2r+cCst dtj¡|_tj|_dS©Né)r6r7r;r8r?rAÚ_stater,r(r(r)r9sszGzipDecoder.__init__rr cCs¤tƒ}|jtjks|st|ƒSz||j |¡7}Wn<tjk
rn|j}tj|_|tj    krht|ƒYS‚YnX|jj
}|s„t|ƒStj    |_t  dtj ¡|_qdSrE) Ú    bytearrayrGr?rCrr8r*r6r:rBÚ unused_datar7r;)r'r!ÚretÚprevious_stater(r(r)r*ws 
 zGzipDecoder.decompresscCs
|j ¡Sr#r=r,r(r(r)r-ŒszGzipDecoder.flushNr>r(r(r(r)rDrsrDc@s(eZdZddœdd„Zddœdd„ZdS)    Ú BrotliDecoderr2r+cCs<t ¡|_t|jdƒr(t|d|jjƒnt|d|jjƒdS)Nr*)ÚbrotliZ Decompressorr8ÚhasattrÚsetattrr*Úprocessr,r(r(r)r9–s
 zBrotliDecoder.__init__rcCst|jdƒr|j ¡SdS)Nr-r3)rNr8r-r,r(r(r)r-s 
zBrotliDecoder.flushN)r.r/r0r9r-r(r(r(r)rL’srLc@s8eZdZddœdd„Zdddœdd„Zddœd    d
„Zd S) Ú ZstdDecoderr2r+cCst ¡ ¡|_dSr#)ÚzstdZZstdDecompressorr7r8r,r(r(r)r9¦szZstdDecoder.__init__rr cCs|sdS|j |¡S)Nr3)r8r*r&r(r(r)r*©szZstdDecoder.decompresscCs|j ¡}|jjstdƒ‚|S)NzZstandard data is incomplete)r8r-Úeofr)r'rJr(r(r)r-®s
zZstdDecoder.flushNr>r(r(r(r)rQ¥srQc@s>eZdZdZdddœdd„Zddœd    d
„Zddd œd d „ZdS)Ú MultiDecodera
    From RFC7231:
        If one or more encodings have been applied to a representation, the
        sender that applied the encodings MUST generate a Content-Encoding
        header field that lists the content codings in the order in which
        they were applied.
    Ústrr2)Úmodesr"cCsdd„| d¡Dƒ|_dS)NcSsg|]}t| ¡ƒ‘qSr()Ú _get_decoderÚstrip)Ú.0Úmr(r(r)Ú
<listcomp>¿sz)MultiDecoder.__init__.<locals>.<listcomp>ú,)ÚsplitÚ    _decoders)r'rVr(r(r)r9¾szMultiDecoder.__init__rr+cCs|jd ¡S©Nr)r^r-r,r(r(r)r-ÁszMultiDecoder.flushr cCst|jƒD]}| |¡}q
|Sr#)Úreversedr^r*)r'r!Údr(r(r)r*Äs zMultiDecoder.decompressN)r.r/r0Ú__doc__r9r-r*r(r(r(r)rTµsrTrU)Úmoder"cCsPd|krt|ƒS|dkrtƒStdk    r4|dkr4tƒStdk    rJ|dkrJtƒStƒS)Nr\ÚgzipÚbrrR)rTrDrMrLrRrQr1)rcr(r(r)rWÊsrWc@sLeZdZdZddœdd„Zddœdd„Zd    dd
œd d „Zdd    d œdd„ZdS)ÚBytesQueueBuffera Memory-efficient bytes buffer
 
    To return decoded data in read() and still follow the BufferedIOBase API, we need a
    buffer to always return the correct amount of bytes.
 
    This buffer should be filled using calls to put()
 
    Our maximum memory usage is determined by the sum of the size of:
 
     * self.buffer, which contains the full data
     * the largest chunk that we will copy in get()
 
    The worst case scenario is a single chunk, in which case we'll make a full copy of
    the data inside get().
    r2r+cCst ¡|_d|_dSr_)Ú collectionsÚdequeÚbufferÚ_sizer,r(r(r)r9ës
zBytesQueueBuffer.__init__ÚintcCs|jSr#)rjr,r(r(r)Ú__len__ïszBytesQueueBuffer.__len__rr cCs"|j |¡|jt|ƒ7_dSr#)riÚappendrjÚlenr&r(r(r)Úputòs zBytesQueueBuffer.put)Únr"c    CsÖ|dkr dS|jstdƒ‚n|dkr,tdƒ‚d}t ¡}||krÎ||}|j ¡}t|ƒ}||kr¤|d|…||d…}}| |¡|j |¡|j    |8_    qÎn| |¡|j    |8_    ||7}|js8qÎq8| 
¡S)Nrr3zbuffer is emptyzn should be > 0) riÚ RuntimeErrorÚ
ValueErrorÚioÚBytesIOÚpopleftrnÚwriteÚ
appendleftrjÚgetvalue)    r'rpZfetchedrJÚ    remainingÚchunkZ chunk_lengthZ
left_chunkZ right_chunkr(r(r)Úgetös0
 
 
 
zBytesQueueBuffer.getN)r.r/r0rbr9rlror{r(r(r(r)rfÚs
rfc
@seZdZUddgZedk    r$edg7Zedk    r6edg7Zdddd    d
gZeej    fZ
d e d <edk    rje
ej    f7Z
edk    r~e
ej f7Z
ddd œdddddddddœdd„Z ddœdd„Zeddœdd„ƒZddœdd „Zeddœd!d"„ƒZejddd#œd$d"„ƒZed%dœd&d'„ƒZeddœd(d)„ƒZejddd*œd+d)„ƒZdUd-d.d/d0œd1d2„ZdVd-d.ddd4œd5d6„ZdWd-d.d/d0œd7d8„Zddœd9d:„Zddœd;d<„Zddœd=d>„Zddœd?d@„Zdd.dddAœdBdC„ZddœdDdE„ZdFddGœdHdI„ZdJdœdKdL„Z dXdMdddNœdOdP„Z!dJdœdQdR„Z"ddœdSdT„Z#dS)YÚBaseHTTPResponserdÚdeflateNrerRi-i.i/i3i4ztuple[type[Exception], ...]ÚDECODER_ERROR_CLASSES)ÚheadersÚretriesú>typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | Nonerkú
str | NoneÚboolú Retry | Noner2)rÚstatusÚversionÚreasonÚdecode_contentÚ request_urlr€r"c
CsŠt|tƒr||_n
t|ƒ|_||_||_||_||_d|_||_||_    d|_
|j  dd¡  ¡}dd„|  d¡Dƒ}    d|    kr€d|_
d|_dS)    NFztransfer-encodingÚcss|]}| ¡VqdSr#)rX)rYÚencr(r(r)Ú    <genexpr>>sz,BaseHTTPResponse.__init__.<locals>.<genexpr>r\ÚchunkedT)Ú
isinstancer rr…r†r‡rˆÚ_has_decoded_contentÚ _request_urlr€rr{Úlowerr]Ú_decoder)
r'rr…r†r‡rˆr‰r€Útr_encÚ    encodingsr(r(r)r9$s 
 
zBaseHTTPResponse.__init__zstr | None | Literal[False]r+cCs|j|jkr|j d¡SdS)a
        Should we redirect and where to?
 
        :returns: Truthy redirect location string if we got a redirect status
            code and valid location. ``None`` if redirect status and no
            location. ``False`` if not a redirect status code.
        ÚlocationF)r…ÚREDIRECT_STATUSESrr{r,r(r(r)Úget_redirect_locationDs  z&BaseHTTPResponse.get_redirect_locationrcCs
tƒ‚dSr#r$r,r(r(r)r!PszBaseHTTPResponse.dataz
typing.AnycCs|j d¡}t |¡S)a
        Parses the body of the HTTP response as JSON.
 
        To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to the decoder.
 
        This method can raise either `UnicodeDecodeError` or `json.JSONDecodeError`.
 
        Read more :ref:`here <json>`.
        zutf-8)r!ÚdecodeÚ_jsonÚloadsr&r(r(r)ÚjsonTs
zBaseHTTPResponse.jsoncCs
tƒ‚dSr#r$r,r(r(r)ÚurlaszBaseHTTPResponse.url©rœr"cCs
tƒ‚dSr#r$©r'rœr(r(r)rœesúHTTPConnection | NonecCs
tƒ‚dSr#r$r,r(r(r)Ú
connectioniszBaseHTTPResponse.connectioncCs|jSr#)Ú_retriesr,r(r(r)r€mszBaseHTTPResponse.retries)r€r"cCs&|dk    r|jr|jdj|_||_dS)Néÿÿÿÿ)ÚhistoryÚredirect_locationrœr¡)r'r€r(r(r)r€qséú
int | Noneú bool | Noneútyping.Iterator[bytes]©Úamtrˆr"cCs
tƒ‚dSr#r$©r'rªrˆr(r(r)ÚstreamxszBaseHTTPResponse.streamF©rªrˆÚ cache_contentr"cCs
tƒ‚dSr#r$)r'rªrˆr®r(r(r)Úread}szBaseHTTPResponse.readcCs
tƒ‚dSr#r$r«r(r(r)Ú read_chunked…szBaseHTTPResponse.read_chunkedcCs
tƒ‚dSr#r$r,r(r(r)Ú release_connŒszBaseHTTPResponse.release_conncCs
tƒ‚dSr#r$r,r(r(r)Ú
drain_connszBaseHTTPResponse.drain_conncCs
tƒ‚dSr#r$r,r(r(r)Úclose’szBaseHTTPResponse.closecsdˆj dd¡ ¡}ˆjdkr`|ˆjkr2t|ƒˆ_n.d|kr`‡fdd„| d¡Dƒ}|r`t|ƒˆ_dS)z=
        Set-up the _decoder attribute if necessary.
        úcontent-encodingrŠNr\cs"g|]}| ¡ˆjkr| ¡‘qSr()rXÚCONTENT_DECODERS)rYÚer,r(r)r[ sþz2BaseHTTPResponse._init_decoder.<locals>.<listcomp>)rr{r‘r’rµrWr])r'Úcontent_encodingr”r(r,r)Ú _init_decoder•s
 
 
þzBaseHTTPResponse._init_decoder)r!rˆÚ flush_decoderr"c
CsŽ|s|jrtdƒ‚|Sz|jr0|j |¡}d|_WnF|jk
rx}z&|j dd¡ ¡}td||ƒ|‚W5d}~XYnX|rŠ||     ¡7}|S)zN
        Decode the data passed in and potentially flush the decoder.
        ú_Calling read(decode_content=False) is not supported after read(decode_content=True) was called.Tr´rŠzEReceived response with content-encoding: %s, but failed to decode it.N)
rrqr’r*r~rr{r‘rÚ_flush_decoder)r'r!rˆr¹r¶r·r(r(r)Ú_decode¨s.ÿ 
ÿýü zBaseHTTPResponse._decodecCs |jr|j d¡|j ¡SdS)zk
        Flushes the decoder. Should only be called if the decoder is actually
        being used.
        r3)r’r*r-r,r(r(r)r»ÆszBaseHTTPResponse._flush_decoderrH)Úbr"cCs:| t|ƒ¡}t|ƒdkrdS||dt|ƒ…<t|ƒSdSr_)r¯rn)r'r½Útempr(r(r)ÚreadintoÐs
 zBaseHTTPResponse.readintor cCstjdtdd|jS)Nz|HTTPResponse.getheaders() is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.r@©ÚcategoryÚ
stacklevel)ÚwarningsÚwarnÚDeprecationWarningrr,r(r(r)Ú
getheadersÙs üzBaseHTTPResponse.getheadersrU)ÚnameÚdefaultr"cCstjdtdd|j ||¡S)Nz‚HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).r@rÀ)rÃrÄrÅrr{)r'rÇrÈr(r(r)Ú    getheaderâs üzBaseHTTPResponse.getheadercCs|jSr#)rr,r(r(r)ÚinfoìszBaseHTTPResponse.infocCs|jSr#)rœr,r(r(r)ÚgeturlïszBaseHTTPResponse.geturl)r¥N)NNF)NN)N)$r.r/r0rµrMrRr–ÚIOErrorr6r:r~Ú__annotations__Z    ZstdErrorr9r—Úpropertyr!r›rœÚsetterr r€r¬r¯r°r±r²r³r¸r¼r»r¿rÆrÉrÊrËr(r(r(r)r|sb
 
 
  ÷    ÿü
ý
        
r|csÔeZdZdZdRddddd    d
d
d d d ddd
d    d    d
ddœ‡fdd„ Zddœdd„Zddœdd„Zeddœdd„ƒZed dœdd„ƒZ    d
dœdd„Z
ddœd d!„Z d    d"d#œd$d%„Z e d&dœd'd(„ƒZdSd"dd)œd*d+„ZdTd"dd)œd,d-„ZdUd"d/d
dd0œd1d2„ZdVd"d/d4d5œd6d7„Zd
dœd8d9„Zddœd:d;„Zed
dœd<d=„ƒZddœd>d?„Zddœd@dA„Zd
dœdBdC„ZddœdDdE„Zd"dd)œdFdG„ZdWd"d/d4d5œdHdI„Zed    dœdJdK„ƒZejdLddMœdNdK„ƒZdOdœdPdQ„Z‡ZS)Xraá
    HTTP Response container.
 
    Backwards-compatible with :class:`http.client.HTTPResponse` but the response ``body`` is
    loaded and decoded on-demand when the ``data`` property is accessed.  This
    class is also compatible with the Python standard library's :mod:`io`
    module, and can hence be treated as a readable object in the context of that
    framework.
 
    Extra parameters for behaviour not present in :class:`http.client.HTTPResponse`:
 
    :param preload_content:
        If True, the response's body will be preloaded during construction.
 
    :param decode_content:
        If True, will attempt to decode the body based on the
        'content-encoding' header.
 
    :param original_response:
        When this HTTPResponse wrapper is generated from an :class:`http.client.HTTPResponse`
        object, it's convenient to include the original for debug purposes. It's
        otherwise unused.
 
    :param retries:
        The retries contains the last :class:`~urllib3.util.retry.Retry` that
        was used during the request.
 
    :param enforce_content_length:
        Enforce content length checking. Body returned by server must match
        value of Content-Length header, if present. Otherwise, raise error.
    rŠNrTr
rrkr‚rƒz_HttplibHTTPResponse | NonezHTTPConnectionPool | NonerŸz_HttplibHTTPMessage | Noner„r2)Úbodyrr…r†r‡Úpreload_contentrˆÚoriginal_responseÚpoolr Úmsgr€Úenforce_content_lengthÚrequest_methodr‰Ú
auto_closer"c    s®tƒj||||||| d| |_||_d|_d|_||_d|_| |_|r\t    |t
t fƒr\||_|    |_ |
|_ t|dƒrx||_d|_| |¡|_tƒ|_|rª|jsª|j|d|_dS)N)rr…r†r‡rˆr‰r€rr¯©rˆ)Úsuperr9rÕr×Ú_bodyÚ_fpÚ_original_responseÚ_fp_bytes_readrÔrŽrUrÚ_poolÚ _connectionrNÚ
chunk_leftÚ _init_lengthÚlength_remainingrfÚ_decoded_bufferr¯)r'rÐrr…r†r‡rÑrˆrÒrÓr rÔr€rÕrÖr‰rשÚ    __class__r(r)r9s6ù
 
 
zHTTPResponse.__init__r+cCs(|jr |jsdS|j |j¡d|_dSr#)rÞrßÚ    _put_connr,r(r(r)r±Ps zHTTPResponse.release_connc Cs.z | ¡Wnttttfk
r(YnXdS)zÏ
        Read and discard any remaining HTTP response data in the response connection.
 
        Unread data in the HTTPResponse connection blocks the connection from being released back to the pool.
        N)r¯rÚOSErrorr rr,r(r(r)r²Ws zHTTPResponse.drain_connrcCs"|jr |jS|jr|jddSdS)NT)r®)rÚrÛr¯r,r(r(r)r!bs
 zHTTPResponse.datacCs|jSr#)rßr,r(r(r)r mszHTTPResponse.connectioncCs
t|jƒSr#)rrÛr,r(r(r)ÚisclosedqszHTTPResponse.isclosedcCs|jS)zì
        Obtain the number of bytes pulled over the wire so far. May differ from
        the amount of content returned by :meth:``urllib3.response.HTTPResponse.read``
        if bytes are encoded on the wire (e.g, compressed).
        )rÝr,r(r(r)ÚtelltszHTTPResponse.tellr¦)rÖr"cCsâ|j d¡}|dk    rˆ|jr(t d¡dSz8dd„| d¡Dƒ}t|ƒdkrVtd|ƒ‚| ¡}Wnt    k
rxd}YqŒX|d    krŒd}nd}zt
|j ƒ}Wnt    k
r²d    }YnX|d
ksÚd |krÐd ksÚn|d krÞd    }|S)zM
        Set initial length value for Response content if available.
        zcontent-lengthNzÒReceived response with both Content-Length and Transfer-Encoding set. This is expressly forbidden by RFC 7230 sec 3.3.2. Ignoring Content-Length and attempting to process response as Transfer-Encoding: chunked.cSsh|] }t|ƒ’qSr()rk)rYÚvalr(r(r)Ú    <setcomp>—sz,HTTPResponse._init_length.<locals>.<setcomp>r\rz8Content-Length contained multiple unmatching values (%s)r)éÌi0édéÈÚHEAD) rr{rÚlogÚwarningr]rnrÚpoprrrkr…)r'rÖÚcontent_lengthÚlengthsÚlengthr…r(r(r)rá|s8 ÿ ÿÿ 
 
&zHTTPResponse._init_lengthz$typing.Generator[(None, None, None)]c
csd}zÂz
dVWn®tk
rB}zt|jddƒ|‚W5d}~XYn~tk
rˆ}z*dt    |ƒkrht
|ƒ|‚t|jddƒ|‚W5d}~XYn8t t fk
r¾}zt d|›|ƒ|‚W5d}~XYnXd}W5|sì|jrÜ|j ¡|jrì|j ¡|jr|j ¡r| ¡XdS)zç
        Catch low-level python exceptions, instead re-raising urllib3
        variants, so that low-level exceptions are not leaked in the
        high-level api.
 
        On exit, release the connection back to the pool.
        FNzRead timed out.zread operation timed outzConnection broken: T)rÜr³rßrèr±Ú SocketTimeoutrrÞr rUrrrçr)r'Ú
clean_exitr¶r(r(r)Ú_error_catcher´s(    
  
 $
 
zHTTPResponse._error_catcher)rªr"cCsÆ|js
t‚d}|r||ks*|jr¤|j|kr¤tjs¤tjs@tjdkr¤t     ¡}d}|dks\|dkrœ|dk    rxt
||ƒ}||8}n|}|j  |¡}|sŽqœ|  |¡~qL|  ¡S|dk    r¸|j  |¡S|j  ¡SdS)a_
        Read a response with the thought that reading the number of bytes
        larger than can fit in a 32-bit int at a time via SSL in some
        known cases leads to an overflow error that has to be prevented
        if `amt` or `self.length_remaining` indicate that a problem may
        happen.
 
        The known cases:
          * 3.8 <= CPython < 3.9.7 because of a bug
            https://github.com/urllib3/urllib3/issues/2513#issuecomment-1152559900.
          * urllib3 injected with pyOpenSSL-backed SSL-support.
          * CPython < 3.10 only when `amt` does not fit 32-bit int.
        iÿÿÿ)éé
iNr)rÛÚAssertionErrorrâr    ÚIS_SECURETRANSPORTÚ IS_PYOPENSSLÚsysÚ version_inforsrtÚminr¯rvrx)r'rªZ    c_int_maxriZ max_chunk_amtZ    chunk_amtr!r(r(r)Ú_fp_readìs<
þþýýûúú
 
 
zHTTPResponse._fp_readc    Cs¾|jdkrdSt|jddƒ}| ¡^|s4| |¡nd}|dk    r~|dkr~|s~|j ¡|jr~|jdk    r~|jdkr~t|j|jƒ‚W5QRX|rº|jt    |ƒ7_|jdk    rº|jt    |ƒ8_|S)z7
        Reads `amt` of bytes from the socket.
        NÚclosedFr3r)
rÛÚgetattrrørr³rÕrârrÝrn)r'rªÚ    fp_closedr!r(r(r)Ú    _raw_reads&
 
    
ÿþý
 
zHTTPResponse._raw_readFr§r­cCs| ¡|dkr|j}|dk    r<d}t|jƒ|kr<|j |¡S| |¡}d}|dkrXd}n|dkrh|shd}|s~t|jƒdkr~|S|dkr | |||¡}|rž||_nx|s¶|jr²t    dƒ‚|S| |||¡}|j 
|¡t|jƒ|kr |r | |¡}| |||¡}|j 
|¡qÐ|j |¡}|S)aT
        Similar to :meth:`http.client.HTTPResponse.read`, but with two additional
        parameters: ``decode_content`` and ``cache_content``.
 
        :param amt:
            How much of the content to read. If specified, caching is skipped
            because it doesn't make sense to cache partial content as the full
            response.
 
        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
 
        :param cache_content:
            If True, will save the returned data such that the same result is
            returned despite of the state of the underlying file object. This
            is useful if you want the ``.data`` property to continue working
            after having ``.read()`` the file object. (Overridden if ``amt`` is
            set.)
        NFTrrº) r¸rˆrnrãr{rr¼rÚrrqro)r'rªrˆr®r!r¹Ú decoded_datar(r(r)r¯FsB 
 ÿ 
 zHTTPResponse.readr¥z#typing.Generator[bytes, None, None]r©ccsZ|jr$| ¡r$|j||dEdHn2t|jƒr<t|jƒdkrV|j||d}|r$|Vq$dS)a_
        A generator wrapper for the read() method. A call will block until
        ``amt`` bytes have been read from the connection or until the
        connection is closed.
 
        :param amt:
            How much of the content to read. The generator will return up to
            much data per iteration, but may return less. This is particularly
            likely when using compressed data. However, the empty string will
            never be returned.
 
        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        rØNr)rªrˆ)rÚsupports_chunked_readsr°rrÛrnrãr¯)r'rªrˆr!r(r(r)r¬‘s zHTTPResponse.streamcCsdS)NTr(r,r(r(r)Úreadable­szHTTPResponse.readablecCs<|js|jr|j ¡|jr&|j ¡|js8tj |¡dSr#)rrÛr³rßr×rsÚIOBaser,r(r(r)r³°s  
 
zHTTPResponse.closecCsT|jstjj |¡S|jdkr"dSt|jdƒr8|j ¡St|jdƒrL|jjSdSdS)NTrèr)r×rsr    rÚ__get__rÛrNrèr,r(r(r)rºs
 
 zHTTPResponse.closedcCs6|jdkrtdƒ‚nt|jdƒr*|j ¡Stdƒ‚dS)Nz-HTTPResponse has no file to get a fileno fromÚfilenozOThe file-like object this HTTPResponse is wrapped around has no file descriptor)rÛrçrNr r,r(r(r)r Çs
 
 
ÿzHTTPResponse.filenocCs2|jdk    r.t|jdƒr.t|jddƒs.|j ¡SdS)Nr-rF)rÛrNrr-r,r(r(r)r-Òsÿ
þ ýzHTTPResponse.flushcCs t|jdƒS)a
        Checks if the underlying file-like object looks like a
        :class:`http.client.HTTPResponse` object. We do this by testing for
        the fp attribute. If it is present we assume it returns raw chunks as
        processed by read_chunked().
        Úfp)rNrÛr,r(r(r)rÚsz#HTTPResponse.supports_chunked_readscCsh|jdk    rdS|jj ¡}| dd¡d}zt|dƒ|_Wn(tk
rb| ¡t||ƒd‚YnXdS)Nó;rrrF)    ràrÛr Úreadliner]rkrrr³r)r'Úliner(r(r)Ú_update_chunk_lengthãs
 z!HTTPResponse._update_chunk_lengthcCs¶d}|dkr2|j |j¡}|}|j d¡d|_n€|jdk    rd||jkrd|j |¡}|j||_|}nN||jkr’|j |¡}|j d¡d|_|}n |j |j¡}|j d¡d|_|S)Nr@)rÛÚ
_safe_readrà)r'rªÚreturned_chunkrzÚvaluer(r(r)Ú _handle_chunkñs&   
   zHTTPResponse._handle_chunkc    cs| ¡|jstdƒ‚| ¡s&tdƒ‚| ¡Ð|jrXt|jƒrX|j ¡W5QR£dS|j    j
dkrrW5QR£dS|  ¡|j dkr†q¬|  |¡}|j||dd}|rr|Vqr|rÂ| ¡}|rÂ|V|j    dk    rê|j    j
 ¡}|sÞqê|dkrÂqêqÂ|jrú|j ¡W5QRXdS)aÆ
        Similar to :meth:`HTTPResponse.read`, but with an additional
        parameter: ``decode_content``.
 
        :param amt:
            How much of the content to read. If specified, caching is skipped
            because it doesn't make sense to cache partial content as the full
            response.
 
        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        zHResponse is not chunked. Header 'transfer-encoding: chunked' is missing.zkBody should be http.client.HTTPResponse like. It should have have an fp attribute which returns raw chunks.NrF)rˆr¹s
)r¸rrrrrørÜrr³rÛr rràrr¼r»r)r'rªrˆrzÚdecodedrr(r(r)r°sLÿÿ
 
 
 
ÿ
 zHTTPResponse.read_chunkedcCs|jS)zÄ
        Returns the URL that was the source of this response.
        If the request that generated this response redirected, this method
        will return the final redirect location.
        ©rr,r(r(r)rœOszHTTPResponse.urlrUrcCs
||_dSr#rržr(r(r)rœXsr¨ccs”g}|jddD]n}d|krt| d¡}d |¡|ddV|dd…D]}|dVqJ|drn|dg}q~g}q| |¡q|rd |¡VdS)NTrØó
r3rrr¢)r¬r]Újoinrm)r'rirzÚchunksÚxr(r(r)Ú__iter__\s
   zHTTPResponse.__iter__)rŠNrrNTTNNNNNTNNT)N)N)NNF)r¥N)NN) r.r/r0rbr9r±r²rÎr!r rèrérárrørrr¯r¬rr³rr r-rrrr°rœrÏrÚ __classcell__r(r(rär)rósp"ï4< 
872þ,üLÿ
      ÿHr)QÚ
__future__rrgrsr›r™ÚloggingÚrerþÚtypingrÃr6Ú
contextlibrÚ http.clientrZ_HttplibHTTPMessagerZ_HttplibHTTPResponseÚsocketrröZ
brotlicffirMÚ ImportErrorZ    zstandardrRÚtupleÚmaprkÚsearchÚ __version__ÚgroupsZ _zstd_versionÚAttributeErrorrrrŠr    Z_base_connectionr
Ú _collectionsr r r r rÚ
exceptionsrrrrrrrrrrZ util.responserrZ
util.retryrÚ TYPE_CHECKINGZtyping_extensionsrÚconnectionpoolrÚ    getLoggerr.rðrr1r?rDrLrQrTrWrfr    r|r(r(r(r)Ú<module>sl      
ÿ
 
   0    
 
 
;_