File: //lib/python3/dist-packages/twisted/web/__pycache__/iweb.cpython-38.pyc
U
s�@g�c �
@ s, d Z ddlmZmZ ddlmZ ddlmZ G dd� de�ZG dd� de�Z G d d
� d
e�Z
G dd� de�ZG d
d� de�ZG dd� de�Z
G dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd � d e�Zd!Zd"ddddddddd#g
Zd$S )%z�
Interface definitions for L{twisted.web}.
@var UNKNOWN_LENGTH: An opaque object which may be used as the value of
L{IBodyProducer.length} to indicate that the length of the entity
body is not known in advance.
� )� Interface� Attribute)�
IPushProducer)�IUsernameDigestHashc @ s e Zd ZdZed�Zed�Zed�Zed�Zed�Z ed�Z
ed�Zd d
� Zdd� Z
d
d� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd;dd�Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd<d,d-�Zd=d.d/�Zd0d1� Zd2d3� Z d4d5� Z!d6d7� Z"d>d9d:�Z#dS )?�IRequestz+
An HTTP request.
@since: 9.0
z.A C{str} giving the HTTP method that was used.zUA C{str} giving the full encoded URI which was requested (including query arguments).z:A C{str} giving the encoded query path of the request URI.z�A mapping of decoded query argument names as C{str} to corresponding query argument values as C{list}s of C{str}. For example, for a URI with C{'foo=bar&foo=baz&quux=spam'} for its query part, C{args} will be C{{'foo': ['bar', 'baz'], 'quux': ['spam']}}.zLA L{http_headers.Headers} instance giving all received HTTP request headers.z�A file-like object giving the request body. This may be a file on disk, a C{StringIO}, or some other type. The implementation is free to decide on a per-request basis.zPA L{http_headers.Headers} instance holding all HTTP response headers to be sent.c C s dS )a%
Get an HTTP request header.
@type key: C{str}
@param key: The name of the header to get the value of.
@rtype: C{str} or L{None}
@return: The value of the specified header, or L{None} if that header
was not present in the request.
N� ��keyr r �2/usr/lib/python3/dist-packages/twisted/web/iweb.py� getHeader4 s zIRequest.getHeaderc C s dS )z>
Get a cookie that was sent from the network.
Nr r r r r
� getCookieA s zIRequest.getCookiec C s dS )z�
Return dictionary mapping the names of all received headers to the last
value received for each.
Since this method does not return all header information,
C{requestHeaders.getAllRawHeaders()} may be preferred.
Nr r r r r
�
getAllHeadersG s zIRequest.getAllHeadersc C s dS )a
Get the hostname that the user passed in to the request.
This will either use the Host: header (if it is available) or the
host we are listening on if the header is unavailable.
@returns: the requested hostname
@rtype: C{str}
Nr r r r r
�getRequestHostnameQ s zIRequest.getRequestHostnamec C s dS )z�
Get my originally requesting transport's host.
@return: An L{IAddress<twisted.internet.interfaces.IAddress>}.
Nr r r r r
�getHost] s zIRequest.getHostc C s dS )a
Return the address of the client who submitted this request.
The address may not be a network address. Callers must check
its type before using it.
@since: 18.4
@return: the client's address.
@rtype: an L{IAddress} provider.
Nr r r r r
�getClientAddresse s zIRequest.getClientAddressc C s dS )aP
Return the IP address of the client who submitted this request.
This method is B{deprecated}. See L{getClientAddress} instead.
@returns: the client IP address or L{None} if the request was submitted
over a transport where IP addresses do not make sense.
@rtype: L{str} or L{None}
Nr r r r r
�getClientIPs s zIRequest.getClientIPc C s dS )z�
Return the HTTP user sent with this request, if any.
If no user was supplied, return the empty string.
@returns: the HTTP user, if any
@rtype: C{str}
Nr r r r r
�getUser s zIRequest.getUserc C s dS )z�
Return the HTTP password sent with this request, if any.
If no password was supplied, return the empty string.
@returns: the HTTP password, if any
@rtype: C{str}
Nr r r r r
�getPassword� s zIRequest.getPasswordc C s dS )az
Return True if this request is using a secure transport.
Normally this method returns True if this request's HTTPChannel
instance is using a transport that implements ISSLTransport.
This will also return True if setHost() has been called
with ssl=True.
@returns: True if this request is secure
@rtype: C{bool}
Nr r r r r
�isSecure� s zIRequest.isSecureNc C s dS )a@
Look up the session associated with this request or create a new one if
there is not one.
@return: The L{Session} instance identified by the session cookie in
the request, or the C{sessionInterface} component of that session
if C{sessionInterface} is specified.
Nr )ZsessionInterfacer r r
�
getSession� s zIRequest.getSessionc C s dS )zp
@return: A L{URLPath} instance which identifies the URL for which this
request is.
Nr r r r r
�URLPath� s zIRequest.URLPathc C s dS )z�
@return: At any time during resource traversal, a L{str} giving an
absolute URL to the most nested resource which has yet been
reached.
Nr r r r r
�
prePathURL� s zIRequest.prePathURLc C s dS )z_
Remember the currently-processed part of the URL for later
recalling.
Nr r r r r
�rememberRootURL� s zIRequest.rememberRootURLc C s dS )z2
Get a previously-remembered URL.
Nr r r r r
�
getRootURL� s zIRequest.getRootURLc C s dS )zI
Indicate that the response to this request is complete.
Nr r r r r
�finish� s zIRequest.finishc C s dS )z�
Write some data to the body of the response to this request. Response
headers are written the first time this method is called, after which
new response headers may not be added.
Nr ��datar r r
�write� s zIRequest.writec C s dS )z�
Set an outgoing HTTP cookie.
In general, you should consider using sessions instead of cookies, see
L{twisted.web.server.Request.getSession} and the
L{twisted.web.server.Session} class for details.
Nr )�k�vZexpiresZdomain�pathZmax_ageZcommentZsecurer r r
� addCookie� s zIRequest.addCookiec C s dS )z-
Set the HTTP response code.
Nr )�code�messager r r
�setResponseCode� s zIRequest.setResponseCodec C s dS )a*
Set an HTTP response header. Overrides any previously set values for
this header.
@type name: C{str}
@param name: The name of the header for which to set the value.
@type value: C{str}
@param value: The value to set for the named header.
Nr )r r r r r
� setHeader� s zIRequest.setHeaderc C s dS )zu
Utility function that does a redirect.
The request should have finish() called after this.
Nr )Zurlr r r
�redirect� s zIRequest.redirectc C s dS )aB
Set the C{Last-Modified} time for the response to this request.
If I am called more than once, I ignore attempts to set Last-Modified
earlier, only replacing the Last-Modified time if it is to a later
value.
If I am a conditional request, I may modify my response code to
L{NOT_MODIFIED<http.NOT_MODIFIED>} if appropriate for the time given.
@param when: The last time the resource being returned was modified, in
seconds since the epoch.
@type when: L{int}, L{long} or L{float}
@return: If I am a C{If-Modified-Since} conditional request and the time
given is not newer than the condition, I return
L{CACHED<http.CACHED>} to indicate that you should write no body.
Otherwise, I return a false value.
Nr )Zwhenr r r
�setLastModified� s zIRequest.setLastModifiedc C s dS )a
Set an C{entity tag} for the outgoing response.
That's "entity tag" as in the HTTP/1.1 I{ETag} header, "used for
comparing two or more entities from the same requested resource."
If I am a conditional request, I may modify my response code to
L{NOT_MODIFIED<http.NOT_MODIFIED>} or
L{PRECONDITION_FAILED<http.PRECONDITION_FAILED>}, if appropriate for the
tag given.
@param etag: The entity tag for the resource being returned.
@type etag: C{str}
@return: If I am a C{If-None-Match} conditional request and the tag
matches one in the request, I return L{CACHED<http.CACHED>} to
indicate that you should write no body. Otherwise, I return a
false value.
Nr )Zetagr r r
�setETag s zIRequest.setETagr c C s dS )a�
Change the host and port the request thinks it's using.
This method is useful for working with reverse HTTP proxies (e.g. both
Squid and Apache's mod_proxy can do this), when the address the HTTP
client is using is different than the one we're listening on.
For example, Apache may be listening on https://www.example.com, and
then forwarding requests to http://localhost:8080, but we don't want
HTML produced by Twisted to say 'http://localhost:8080', they should
say 'https://www.example.com', so we do::
request.setHost('www.example.com', 443, ssl=1)
Nr )Zhost�portZsslr r r
�setHost+ s zIRequest.setHost)N)NNNNNN)N)r )$�__name__�
__module__�__qualname__�__doc__r �method�urir �argsZrequestHeadersZcontentZresponseHeadersr r r
r r r r r r r r r r r r r r r! r$ r% r&