Files
intellecton/venv/lib/python3.12/site-packages/urllib3/__pycache__/fields.cpython-312.pyc
T

161 lines
12 KiB
Plaintext
Raw Normal View History

Ë
JÀj1*ãóΗddlmZddlZddlZddlZej eefZ ej e e
ee fe
ee effZ d
d d„Z d d„Z
d d„Zd d„Zd d„ZGd„d «Zy)
é)Ú annotationsNcóB—|rtj|«dxs|S|S)zæ
Guess the "Content-Type" of a file.
:param filename:
The filename to guess the "Content-Type" of using :mod:`mimetypes`.
:param default:
If no "Content-Type" can be guessed, default to `default`.
r)Ú mimetypesÚ
guess_type)ÚfilenameÚdefaults úQ/home/antigravity/intellecton/venv/lib/python3.12/site-packages/urllib3/fields.pyÚguess_content_typer
s'€ñÜ×#Ñ# HÓ-¨aÑ0Ò;°GÐ;Ø €NócóZ‡—ddl}|jdtd¬«t‰t«r‰j d«Št
ˆfd„dD««s|›d ‰›d
�} |jd «|Stjj‰d«Š|›d ‰›�ЉS#ttf$rYŒ:wxYw)
a²
Helper function to format and quote a single header parameter using the
strategy defined in RFC 2231.
Particularly useful for header parameters which might contain
non-ASCII values, like file names. This follows
`RFC 2388 Section 4.4 <https://tools.ietf.org/html/rfc2388#section-4.4>`_.
:param name:
The name of the parameter, a string expected to be ASCII only.
:param value:
The value of the parameter, provided as ``bytes`` or `str``.
:returns:
An RFC-2231-formatted unicode string.
.. deprecated:: 2.0.0
Will be removed in urllib3 v3.0. This is not valid for
``multipart/form-data`` header parameters.
rNz—'format_header_param_rfc2231' is insecure, deprecated and will be removed in urllib3 v3.0. This is not valid for multipart/form-data header parameters.é©Ú
stacklevelúutf-8c3ó&•K—|]}|‰v–—Œ
y­w©N©)Ú.0ÚchÚvalues €r ú <genexpr>z.format_header_param_rfc2231.<locals>.<genexpr>@søèø€Ò/˜rˆr�UŒ{Ñ/ùsƒz"\
ú="ú"Úasciiz*=)
ÚwarningsÚwarnÚ
FutureWarningÚ
isinstanceÚbytesÚdecodeÚanyÚencodeÚUnicodeEncodeErrorÚUnicodeDecodeErrorÚemailÚutilsÚencode_rfc2231)ÚnamerrÚresults ` r Úformat_header_param_rfc2231r*s½ø€ó(à ‡M�Mð 1ô Øð ôô�%œÔØ— ‘ ˜WÓ%ˆä Ó/ YÔ/Ô /Ø�6˜˜E˜7 !Ð$ˆð Ø �M‰M˜'Ô "ðˆMä �K‰K× &Ñ & u¨gÓ 6€E؈f�B�u�gÐ €Eà €Løô#Ô$6Ð7ò Ù ð úsÁBÂB*Â)B*có~—t|t«r|jd«}|jddddœ«}|›d|›d�S)aë
Format and quote a single multipart header parameter.
This follows the `WHATWG HTML Standard`_ as of 2021/06/10, matching
the behavior of current browser and curl versions. Values are
assumed to be UTF-8. The ``\n``, ``\r``, and ``"`` characters are
percent encoded.
.. _WHATWG HTML Standard:
https://html.spec.whatwg.org/multipage/
form-control-infrastructure.html#multipart-form-data
:param name:
The name of the parameter, an ASCII-only ``str``.
:param value:
The value of the parameter, a ``str`` or UTF-8 encoded
``bytes``.
:returns:
A string ``name="value"`` with the escaped value.
.. versionchanged:: 2.0.0
Matches the WHATWG HTML Standard as of 2021/06/10. Control
characters are no longer percent encoded.
.. versionchanged:: 2.0.0
Renamed from ``format_header_param_html5`` and
``format_header_param``. The old names will be removed in
urllib3 v3.0.
rz%0Az%0Dz%22)é
é
é"rr)rrr Ú translate)r(rs r Úformat_multipart_header_paramr0OsF€ô<�%œÔØ— ‘ ˜WÓ%ˆð
�O‰O ¨E°uÑ=Ó >€E؈V�2�e�W˜AÐ Ðr cóR—ddl}|jdtd¬«t||«S)ú‚
.. deprecated:: 2.0.0
Renamed to :func:`format_multipart_header_param`. Will be
removed in urllib3 v3.0.
rNz~'format_header_param_html5' has been renamed to 'format_multipart_header_param'. The old name will be removed in urllib3 v3.0.r
r©rrrr0©r(rrs r Úformat_header_param_html5r5uó4€ó à ‡M�Mð #ô Øð ôô )¨¨uÓ 5Ð5r cóR—ddl}|jdtd¬«t||«S)r2rNzx'format_header_param' has been renamed to 'format_multipart_header_param'. The old name will be removed in urllib3 v3.0.r
rr3r4s r Úformat_header_paramr8‡r6r có”—eZdZdZ d d
d„Ze d d d„«Zd
d„Z dd„Zdd„Z d dd„Z
y)Ú RequestFieldaò
A data container for request body parameters.
:param name:
The name of this request field. Must be unicode.
:param data:
The data/value body.
:param filename:
An optional filename of the request field. Must be unicode.
:param headers:
An optional dict-like object of headers to initially use for the field.
.. versionchanged:: 2.0.0
The ``header_formatter`` parameter is deprecated and will
be removed in urllib3 v3.0.
Ncó—||_||_||_i|_|rt |«|_|�$ddl}|j
dtd¬«||_yt|_y)NrzSThe 'header_formatter' parameter is deprecated and will be removed in urllib3 v3.0.r
r)
Ú_nameÚ _filenameÚdataÚheadersÚdictrrrÚheader_formatterr0)Úselfr(r>rr?rArs r Ú__init__zRequestField.__init__«se€ðˆŒ
Ø!ˆŒØˆŒ Ø.0ˆŒ Ù Ü ›=ˆDŒLà Ð 'Û à �M‰Mð3äØð
ô
ð %5ˆDÕ !ä$AˆDÕ !r cóº—t|t«r&t|«dk(r|\}}}n|\}}t|«}nd}d}|}|||||¬«}|j |¬«|S)a³
A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters.
Supports constructing :class:`~urllib3.fields.RequestField` from
parameter of key/value strings AND key/filetuple. A filetuple is a
(filename, data, MIME type) tuple where the MIME type is optional.
For example::
'foo': 'bar',
'fakefile': ('foofile.txt', 'contents of foofile'),
'realfile': ('barfile.txt', open('realfile').read()),
'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'),
'nonamefile': 'contents of nonamefile field',
Field names and filenames must be unicode.
éN)rrA)Ú content_type)rÚtupleÚlenr
Úmake_multipart)ÚclsÚ fieldnamerrArr>rFÚ
request_params r Ú from_tupleszRequestField.from_tuplesÇst€ô6 �eœUÔ #Ü�5‹z˜QŠØ/4Ñ,�˜$¡ à!&‘�˜$Ü1°(Ó;‘ àˆH؈L؈DáØ �t hÐAQô
ˆ
ð ×$Ñ$°,Ð$Ô?àÐr có&—|j||«S)a‹
Override this method to change how each multipart header
parameter is formatted. By default, this calls
:func:`format_multipart_header_param`.
:param name:
The name of the parameter, an ASCII-only ``str``.
:param value:
The value of the parameter, a ``str`` or UTF-8 encoded
``bytes``.
:meta public:
)rA)rBr(rs r Ú _render_partzRequestField._render_partôs€ð×$Ñ$ T¨5Ó1Ð1r cóÊ—g}t|t«r|j«}n|}|D])\}}|€Œ |j|j ||««Œ+dj |«S)aO
Helper function to format and quote a single header.
Useful for single headers that are composed of multiple items. E.g.,
'Content-Disposition' fields.
:param header_parts:
A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format
as `k1="v1"; k2="v2"; ...`.
ú; )rr@ÚitemsÚappendrOÚjoin)rBÚ header_partsÚpartsÚiterabler(rs r Ú
_render_partszRequestField._render_partssi€ð&ˆÜ �l¤DÔ )Ø#×)Ñ)Ó+‰Hà#ˆHà#ò =‰KˆD�%ØÑ Ø— ‘ ˜T×.Ñ.¨t°UÓ;Õ<ð =ð�y‰y˜ÓÐr có`—g}gd¢}|D]B}|jj|d«sŒ |j|›d|j|›�«ŒD|jj«D]#\}}||vsŒ |sŒ|j|›d|›�«Œ%|jd«dj |«S)z=
Renders the headers for this request field.
)úContent-Dispositionú Content-TypeúContent-LocationFz: z
)r?ÚgetrSrRrT)rBÚlinesÚ sort_keysÚsort_keyÚ header_nameÚ header_values r Úrender_headerszRequestField.render_headers#s¸€ðˆâOˆ Ø!ò FˆHØ�|‰|×Ñ ¨%Õ0Ø— ‘  ˜z¨¨D¯L©L¸Ñ,BÐ+CÐDÕEð Fð*.¯©×);Ñ);Ó)=ò CÑ %ˆK˜Ø )Ò+ÚØ—L‘L K =°°<°.Ð!AÕBð Cð
� ‰ �VÔØ�{‰{˜5Ó!Ð!r c óä—|xsddjd|jd|jfd|jff«g«z}||jd<||jd<||jd<y )
aó
Makes this request field into a multipart request field.
This method overrides "Content-Disposition", "Content-Type" and
"Content-Location" headers to the request parameter.
:param content_disposition:
The 'Content-Disposition' of the request body. Defaults to 'form-data'
:param content_type:
The 'Content-Type' of the request body.
:param content_location:
The 'Content-Location' of the request body.