zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
U
Þ=®d³^ã@s®ddlmZddlZddlZddlmZddlmZddlm    Z    ddlm
Z
ddlm Z dd    lm Z dd
lm Z dd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl#m%Z%d d!lm&Z&d d"l#m'Z'd d#l#m(Z(d d$l#m)Z)Gd%d&„d&ƒZ*dS)'é)Ú annotationsN)Údatetime)Ú    parse_qslé)ÚAccept)Ú Authorization)Ú CharsetAccept)ÚETags)ÚHeaders)Ú    HeaderSet)ÚIfRange)Ú ImmutableList)ÚImmutableMultiDict)ÚLanguageAccept)Ú
MIMEAccept)Ú    MultiDict)ÚRange)ÚRequestCacheControl)Úparse_accept_header)Úparse_cache_control_header)Ú
parse_date)Ú parse_etags)Úparse_if_range_header)Úparse_list_header)Úparse_options_header)Úparse_range_header)Úparse_set_header)Ú    UserAgent)Úcached_property)Úheader_propertyé)Ú parse_cookie)Úget_content_length)Úget_current_url)Úget_hostc
@s°eZdZUdZded<eddœdd„ƒZejdddœd    d„ƒZded
<eddœd d „ƒZejdddœd d „ƒZded<eddœdd„ƒZ    e    jdddœdd„ƒZ    e
Z ded<e
Z ded<e Zded<eZded<dZded<dddddddddd œ    d!d"„Zddœd#d$„Zed%dœd&d'„ƒZed(dœd)d*„ƒZeddœd+d,„ƒZed-dœd.d/„ƒZeddœd0d1„ƒZeddœd2d3„ƒZeddœd4d5„ƒZeddœd6d7„ƒZeddœd8d9„ƒZed:dœd;d<„ƒZee d=d>d?d@Z!edAdœdBdC„ƒZ"ee dDdEd?d@Z#ee dFdGd?d@Z$ee dHdId?d@Z%edJde&dKd?d@Z'edLde(dMd?d@Z)ddœdNdO„Z*eddœdPdQ„ƒZ+edRdœdSdT„ƒZ,edUdœdVdW„ƒZ-edXdœdYdZ„ƒZ.ed[dœd\d]„ƒZ/ed^dœd_d`„ƒZ0edadœdbdc„ƒZ1edddœdedf„ƒZ2edgdœdhdi„ƒZ3edgdœdjdk„ƒZ4edldœdmdn„ƒZ5edldœdodp„ƒZ6edqdœdrds„ƒZ7edtdœdudv„ƒZ8edwdœdxdy„ƒZ9edzdœd{d|„ƒZ:ee d}d~d?d@Z;ede<d€d?dZ=ee d‚dƒd?d@Z>ed-dœd„d…„ƒZ?dS)†ÚRequesta8Represents the non-IO parts of a HTTP request, including the
    method, URL info, and headers.
 
    This class is not meant for general use. It should only be used when
    implementing WSGI, ASGI, or another HTTP application spec. Werkzeug
    provides a WSGI implementation at :cls:`werkzeug.wrappers.Request`.
 
    :param method: The method the request was made with, such as
        ``GET``.
    :param scheme: The URL scheme of the protocol the request used, such
        as ``https`` or ``wss``.
    :param server: The address of the server. ``(host, port)``,
        ``(path, None)`` for unix sockets, or ``None`` if not known.
    :param root_path: The prefix that the application is mounted under.
        This is prepended to generated URLs, but is not part of route
        matching.
    :param path: The path part of the URL after ``root_path``.
    :param query_string: The part of the URL after the "?".
    :param headers: The headers received with the request.
    :param remote_addr: The address of the client sending the request.
 
    .. versionadded:: 2.0
    ÚstrÚ_charset)ÚreturncCstjdtdd|jS)zÀThe charset used to decode body, form, and cookie data. Defaults to UTF-8.
 
        .. deprecated:: 2.3
            Will be removed in Werkzeug 3.0. Request data must always be UTF-8.
        úœThe 'charset' attribute is deprecated and will not be used in Werkzeug 2.4. Interpreting bytes as text in body, form, and cookie data will always use UTF-8.r©Ú
stacklevel©ÚwarningsÚwarnÚDeprecationWarningr'©Úself©r2úNd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\werkzeug/sansio/request.pyÚcharsetCs ûzRequest.charsetÚNone)Úvaluer(cCstjdtdd||_dS)Nr)rr*r,©r1r6r2r2r3r4Ss ûÚ_encoding_errorscCstjdtdd|jS)z•How errors when decoding bytes are handled. Defaults to "replace".
 
        .. deprecated:: 2.3
            Will be removed in Werkzeug 3.0.
        úSThe 'encoding_errors' attribute is deprecated and will not be used in Werkzeug 3.0.rr*©r-r.r/r8r0r2r2r3Úencoding_errors`s üzRequest.encoding_errorscCstjdtdd||_dS)Nr9rr*r:r7r2r2r3r;os üÚ _url_charsetcCstjdtdd|jS)a0The charset to use when decoding percent-encoded bytes in :attr:`args`.
        Defaults to the value of :attr:`charset`, which defaults to UTF-8.
 
        .. deprecated:: 2.3
            Will be removed in Werkzeug 3.0. Percent-encoded bytes must always be UTF-8.
 
        .. versionadded:: 0.6
        ú{The 'url_charset' attribute is deprecated and will not be used in Werkzeug 3.0. Percent-encoded bytes must always be UTF-8.rr*©r-r.r/r<r0r2r2r3Ú url_charset{s
üzRequest.url_charsetcCstjdtdd||_dS)Nr=rr*r>r7r2r2r3r?s üztype[MultiDict]Úparameter_storage_classÚdict_storage_classz type[t.List]Úlist_storage_classztype[UserAgent]Úuser_agent_classNzlist[str] | NoneÚ trusted_hostsztuple[str, int | None] | NoneÚbytesr
z
str | None)    ÚmethodÚschemeÚserverÚ    root_pathÚpathÚ query_stringÚheadersÚ remote_addrr(c        CsÚtt|ƒjtƒs*tjdtdd|j|_nd|_tt|ƒjtƒsZtjdtdd|j|_    nd|_    tt|ƒj
tƒsŠtjdtdd|j
|_ n|j|_ |  ¡|_ ||_||_| d¡|_d| d¡|_||_||_||_dS)    Nr)rr*úutf-8r9Úreplacer=ú/)Ú
isinstanceÚtyper4Úpropertyr-r.r/r'r;r8r?r<ÚupperrFrGrHÚrstriprIÚlstriprJrKrLrM)    r1rFrGrHrIrJrKrLrMr2r2r3Ú__init__És@ û
ü
ü
 
 zRequest.__init__c
CsZz
|j}Wn.tk
r8}zd|›d}W5d}~XYnXdt|ƒj›d|›d|j›dS)Nz(invalid URL: ú)ú<ú z [z]>)ÚurlÚ    ExceptionrRÚ__name__rF)r1r[Úer2r2r3Ú__repr__ s
 
zRequest.__repr__zMultiDict[str, str]cCs| t|j ¡d|jdd¡S)aÒThe parsed URL parameters (the part in the URL after the question
        mark).
 
        By default an
        :class:`~werkzeug.datastructures.ImmutableMultiDict`
        is returned from this function.  This can be changed by setting
        :attr:`parameter_storage_class` to a different type.  This might
        be necessary if the order of the form data is important.
 
        .. versionchanged:: 2.3
            Invalid bytes remain percent encoded.
        Tzwerkzeug.url_quote)Úkeep_blank_valuesÚencodingÚerrors)r@rrKÚdecoder<r0r2r2r3Úargssüÿz Request.argsz    list[str]cCs>d|jkr| t|jdƒ¡S|jdk    r6| |jg¡S| ¡S)z}If a forwarded header exists this is a list of all ip addresses
        from the client ip to the last proxy server.
        zX-Forwarded-ForN)rLrBrrMr0r2r2r3Ú access_route+s
 ÿ
zRequest.access_routecCs|j›d|j ¡›S)z+Requested path, including the query string.ú?)rJrKrcr0r2r2r3Ú    full_path8szRequest.full_pathÚboolcCs
|jdkS)zX``True`` if the request was made with a secure protocol
        (HTTPS or WSS).
        >ÚhttpsÚwss)rGr0r2r2r3Ú    is_secure=szRequest.is_securecCst|j|j|j|j|jƒS)zVThe full request URL with the scheme, host, root path, path,
        and query string.)r#rGÚhostrIrJrKr0r2r2r3r[Dsÿz Request.urlcCst|j|j|j|jƒS)z.Like :attr:`url` but without the query string.)r#rGrlrIrJr0r2r2r3Úbase_urlLszRequest.base_urlcCst|j|j|jƒS)zuThe request URL scheme, host, and root path. This is the root
        that the application is accessed from.
        )r#rGrlrIr0r2r2r3Úroot_urlQszRequest.root_urlcCst|j|jƒS)z%The request URL scheme and host only.)r#rGrlr0r2r2r3Úhost_urlXszRequest.host_urlcCst|j|j d¡|j|jƒS)z†The host name the request was made to, including the port if
        it's non-standard. Validated with :attr:`trusted_hosts`.
        rl)r$rGrLÚgetrHrDr0r2r2r3rl]s 
ÿz Request.hostzImmutableMultiDict[str, str]cCsLd |j d¡¡}|jdkr"|jnd}|jdkr6|jnd}t||||jdS)zVA :class:`dict` with the contents of all cookies transmitted with
        the request.ú;ÚCookierNNrO)r4rbÚcls)ÚjoinrLÚgetlistr'r8r!rA)r1Zwsgi_combined_cookier4rbr2r2r3ÚcookiesfsüzRequest.cookiesú Content-TypezçThe Content-Type entity-header field indicates the media
        type of the entity-body sent to the recipient or, in the case of
        the HEAD method, the media type that would have been sent had
        the request been a GET.T)ÚdocÚ    read_onlyz
int | NonecCst|j d¡|j d¡dS)zìThe Content-Length entity-header field indicates the size of the
        entity-body in bytes or, in the case of the HEAD method, the size of
        the entity-body that would have been sent had the request been a
        GET.
        zContent-LengthzTransfer-Encoding)Zhttp_content_lengthZhttp_transfer_encoding)r"rLrpr0r2r2r3Úcontent_lengths
 
þzRequest.content_lengthzContent-EncodingaThe Content-Encoding entity-header field is used as a
        modifier to the media-type. When present, its value indicates
        what additional content codings have been applied to the
        entity-body, and thus what decoding mechanisms must be applied
        in order to obtain the media-type referenced by the Content-Type
        header field.
 
        .. versionadded:: 0.9z Content-MD5a‹The Content-MD5 entity-header field, as defined in
        RFC 1864, is an MD5 digest of the entity-body for the purpose of
        providing an end-to-end message integrity check (MIC) of the
        entity-body. (Note: a MIC is good for detecting accidental
        modification of the entity-body in transit, but is not proof
        against malicious attacks.)
 
        .. versionadded:: 0.9ZRefererzúThe Referer[sic] request-header field allows the client
        to specify, for the server's benefit, the address (URI) of the
        resource from which the Request-URI was obtained (the
        "referrer", although the header field is misspelled).ÚDatezÿThe Date general-header field represents the date and
        time at which the message was originated, having the same
        semantics as orig-date in RFC 822.
 
        .. versionchanged:: 2.0
            The datetime object is timezone-aware.
        z Max-ForwardszÙThe Max-Forwards request-header field provides a
        mechanism with the TRACE and OPTIONS methods to limit the number
        of proxies or gateways that can forward the request to the next
        inbound server.cCs"t|dƒst|j dd¡ƒ|_dS)NÚ_parsed_content_typerwÚ)ÚhasattrrrLrpr|r0r2r2r3Ú_parse_content_typeÃs
 ÿzRequest._parse_content_typecCs| ¡|jd ¡S)zñLike :attr:`content_type`, but without parameters (eg, without
        charset, type etc.) and always lowercase.  For example if the content
        type is ``text/HTML; charset=utf-8`` the mimetype would be
        ``'text/html'``.
        r)rr|Úlowerr0r2r2r3ÚmimetypeÉszRequest.mimetypezdict[str, str]cCs| ¡|jdS)z¨The mimetype parameters as dict.  For example if the content
        type is ``text/html; charset=utf-8`` the params would be
        ``{'charset': 'utf-8'}``.
        r )rr|r0r2r2r3Úmimetype_paramsÓszRequest.mimetype_paramsr cCst|j dd¡ƒS)ajThe Pragma general-header field is used to include
        implementation-specific directives that might apply to any recipient
        along the request/response chain.  All pragma directives specify
        optional behavior from the viewpoint of the protocol; however, some
        systems MAY require that behavior be consistent with the directives.
        ZPragmar})rrLrpr0r2r2r3ÚpragmaÜszRequest.pragmarcCst|j d¡tƒS)zoList of mimetypes this client supports as
        :class:`~werkzeug.datastructures.MIMEAccept` object.
        r)rrLrprr0r2r2r3Úaccept_mimetypesèszRequest.accept_mimetypesrcCst|j d¡tƒS)zqList of charsets this client supports as
        :class:`~werkzeug.datastructures.CharsetAccept` object.
        zAccept-Charset)rrLrprr0r2r2r3Úaccept_charsetsïszRequest.accept_charsetsrcCst|j d¡ƒS)z¶List of encodings this client accepts.  Encodings in a HTTP term
        are compression encodings such as gzip.  For charsets have a look at
        :attr:`accept_charset`.
        zAccept-Encoding)rrLrpr0r2r2r3Úaccept_encodingsöszRequest.accept_encodingsrcCst|j d¡tƒS)aList of languages this client accepts as
        :class:`~werkzeug.datastructures.LanguageAccept` object.
 
        .. versionchanged 0.5
           In previous versions this was a regular
           :class:`~werkzeug.datastructures.Accept` object.
        zAccept-Language)rrLrprr0r2r2r3Úaccept_languagesþs    zRequest.accept_languagesrcCs|j d¡}t|dtƒS)zwA :class:`~werkzeug.datastructures.RequestCacheControl` object
        for the incoming cache control headers.
        z Cache-ControlN)rLrprr)r1Ú cache_controlr2r2r3rˆ s zRequest.cache_controlr    cCst|j d¡ƒS)z~An object containing all the etags in the `If-Match` header.
 
        :rtype: :class:`~werkzeug.datastructures.ETags`
        zIf-Match©rrLrpr0r2r2r3Úif_matchszRequest.if_matchcCst|j d¡ƒS)zƒAn object containing all the etags in the `If-None-Match` header.
 
        :rtype: :class:`~werkzeug.datastructures.ETags`
        z If-None-Matchr‰r0r2r2r3Ú if_none_matchszRequest.if_none_matchzdatetime | NonecCst|j d¡ƒS)z˜The parsed `If-Modified-Since` header as a datetime object.
 
        .. versionchanged:: 2.0
            The datetime object is timezone-aware.
        zIf-Modified-Since©rrLrpr0r2r2r3Úif_modified_since#szRequest.if_modified_sincecCst|j d¡ƒS)zšThe parsed `If-Unmodified-Since` header as a datetime object.
 
        .. versionchanged:: 2.0
            The datetime object is timezone-aware.
        zIf-Unmodified-SincerŒr0r2r2r3Úif_unmodified_since,szRequest.if_unmodified_sincer cCst|j d¡ƒS)z˜The parsed ``If-Range`` header.
 
        .. versionchanged:: 2.0
            ``IfRange.date`` is timezone-aware.
 
        .. versionadded:: 0.7
        zIf-Range)rrLrpr0r2r2r3Úif_range5s    zRequest.if_rangez Range | NonecCst|j d¡ƒS)z{The parsed `Range` header.
 
        .. versionadded:: 0.7
 
        :rtype: :class:`~werkzeug.datastructures.Range`
        r)rrLrpr0r2r2r3Úrange@sz Request.rangercCs| |j dd¡¡S)a«The user agent. Use ``user_agent.string`` to get the header
        value. Set :attr:`user_agent_class` to a subclass of
        :class:`~werkzeug.user_agent.UserAgent` to provide parsing for
        the other properties or other extended data.
 
        .. versionchanged:: 2.1
            The built-in parser was removed. Set ``user_agent_class`` to a ``UserAgent``
            subclass to parse data from the string.
        z
User-Agentr})rCrLrpr0r2r2r3Ú
user_agentLs zRequest.user_agentzAuthorization | NonecCst |j d¡¡S)aGThe ``Authorization`` header parsed into an :class:`.Authorization` object.
        ``None`` if the header is not present.
 
        .. versionchanged:: 2.3
            :class:`Authorization` is no longer a ``dict``. The ``token`` attribute
            was added for auth schemes that use a token instead of parameters.
        r)rZ from_headerrLrpr0r2r2r3Ú authorization[s    zRequest.authorizationZOriginzœThe host that the request originated from. Set :attr:`~CORSResponseMixin.access_control_allow_origin` on the response to indicate which origins are allowed.zAccess-Control-Request-HeaderszÖSent with a preflight request to indicate which headers will be sent with the cross origin request. Set :attr:`~CORSResponseMixin.access_control_allow_headers` on the response to indicate which headers are allowed.)Z    load_funcrxryzAccess-Control-Request-MethodzÔSent with a preflight request to indicate which method will be used for the cross origin request. Set :attr:`~CORSResponseMixin.access_control_allow_methods` on the response to indicate which methods are allowed.cCs"|j}|dkp | d¡o | d¡S)z‚Check if the mimetype indicates JSON data, either
        :mimetype:`application/json` or :mimetype:`application/*+json`.
        zapplication/jsonz application/z+json)rÚ
startswithÚendswith)r1Úmtr2r2r3Úis_json‰s
 
ýzRequest.is_json)@r]Ú
__module__Ú __qualname__Ú__doc__Ú__annotations__rSr4Úsetterr;r?rr@rAr rBrrCrDrWr_rrdrergrkr[rmrnrorlrvrr&Ú content_typerzÚcontent_encodingZ content_md5ZreferrerrÚdateÚintZ max_forwardsrrr‚rƒr„r…r†r‡rˆrŠr‹rrŽrrr‘r’ÚoriginrZaccess_control_request_headersZaccess_control_request_methodr–r2r2r2r3r%(s
 
    
   C ú     ö ö úõ ø       
  ù
÷ ø r%)+Ú
__future__rÚtypingÚtr-rÚ urllib.parserZdatastructuresrrrr    r
r r r rrrrrrÚhttprrrrrrrrrr‘rÚutilsrrr!r"r#r$r%r2r2r2r3Ú<module>sF