K i &UddlmZddlZddlZddlmZddlmZddlm Z ddl m Z ejrdd lm Z d Zegd Zd Z ddlZed z Z ddlmZedz ZGddeZej6Zded<ej<eefZ hdZ! d ddZ" ddZ#ddZ$GddejJZ& ddZ'y#e$rddlZYwxYw#e$rYwxYw#e$r ddlZedz Zn #e$rYnwxYwYwxYw) ) annotationsN) b64encode)Enum)UnrewindableBodyError)to_bytes)Finalz@@@SKIP_HEADER@@@)accept-encodinghost user-agentz gzip,deflatez,br)zstdz,zstdceZdZdZy)_TYPE_FAILEDTELLrN)__name__ __module__ __qualname__tokenZ/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/urllib3/util/request.pyrr/s ErrzFinal[_TYPE_FAILEDTELL] _FAILEDTELL>GETHEADTRACEDELETECONNECTOPTIONScti}|r>t|trn(t|trdj|}nt}||d<|r||d<|rd|d<|r.dt |j dj|d<|r.dt |j dj|d <|rd |d <|S) ad 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 the dependencies for Brotli (either the ``brotli`` or ``brotlicffi`` package) and/or Zstandard (the ``zstandard`` package) algorithms are installed, then their encodings are included in the string ('br' and 'zstd', respectively). 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) isinstancestrlistjoinACCEPT_ENCODINGrencodedecode) keep_aliveaccept_encoding user_agent basic_authproxy_basic_auth disable_cacheheaderss r make_headersr1?sb!G os +   .!hh7O-O%4!" *  , Yz00;<CCEF G  Y/66yABIIKL M %&#- Nrc|t|||St|dd |j}|S|S#t$r t}Y|SwxYw)z If a position is provided, move file to that point. Otherwise, we'll attempt to record a position for future use. Ntell) rewind_bodygetattrr3OSErrorr)bodyposs rset_file_positionr9sc D# J vt $ 0 ))+C J3J  C J  s3AAct|dd}|t|tr ||y|t ur t dt dt|d#t$r}t d|d}~wwxYw)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 .)r5r#intr6rr ValueErrortype)r7body_pos body_seekes rr4r4sfd+IHc!:  h  [ # 4  ?X?Oq Q   'S  sA A/ A**A/c"eZdZUded<ded<y)ChunksAndContentLengthztyping.Iterable[bytes] | Nonechunksz int | Nonecontent_lengthN)rrr__annotations__rrrrDrDs ))rrDcd}|jtvrd}nld}nitttfrt f}t |d}n8tdrdfd }|}d}n t}f}|j}t||S#t$r. t}d}n#t$rtddwxYwYCwxYw)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. Nrreadc3Kttj} j}|sy|r|j d}|,w)Nzutf-8)r#io TextIOBaserIr()r( datablock blocksizer7s rchunk_readablez&body_to_chunks..chunk_readablesKbmm4F IIi0   ) 0 0 9I sAA zO'body' must be a bytes-like object, file-like object, or iterable. Instead was )rErF)returnztyping.Iterable[bytes]) upper_METHODS_NOT_EXPECTING_BODYr#r$bytesr lenhasattr memoryviewnbytes TypeErroriterrD)r7methodrNrErFrOmvs` ` rbody_to_chunksr\s$ | <<>!< <N!N D3, '4."VAY v   ! 'D!BWFYYN ! OO  d!% 88rus" .  " GH /2 uO  wOt(8'='= $=ll3(8#89W#59!!#'!% NN2NN N ! N  NNb 5( <V.. CP CP%(CP58CPCP] /./    /7"     s` C C2 C$!C'#C$$C''C/.C/2D8 DDD D D  DD