[ Pobierz całość w formacie PDF ]

the  before_request_body and  before_handler hooks.
path_info=  /
The  relative path portion of the Request-URI. This is relative to the script_name ( mount point ) of the
application which is handling this request.
prev= None
The previous Request object (if any). This should be None unless we are processing an InternalRedirect.
process_headers()
Parse HTTP header data into Python structures. (Core)
process_query_string()
Parse the query string into Python structures. (Core)
7.7. cherrypy._cprequest 109
CherryPy Documentation, Release 3.2.4
process_request_body= True
If True, the rfile (if any) is automatically read and parsed, and the result placed into request.params or
request.body.
protocol= (1, 1)
The HTTP protocol version corresponding to the set of features which should be allowed in the response. If
BOTH the client s request message AND the server s level of HTTP compliance is HTTP/1.1, this attribute
will be the tuple (1, 1). If either is 1.0, this attribute will be the tuple (1, 0). Lower HTTP protocol versions
are not explicitly supported.
query_string=  
The query component of the Request-URI, a string of information to be interpreted by the resource. The
query portion of a URI follows the path component, and is separated by a  ? . For example, the URI
 http://www.cherrypy.org/wiki?a=3&b=4 has the query component,  a=3&b=4 .
query_string_encoding=  utf8
The encoding expected for query string arguments after % HEX HEX decoding). If a query string is
provided that cannot be decoded with this encoding, 404 is raised (since technically it s a different URI).
If you want arbitrary encodings to not error, set this to  Latin-1 ; you can then encode back to bytes and
re-decode to whatever encoding you like later.
remote= httputil.Host( 127.0.0.1 , 1111,  127.0.0.1 )
An httputil.Host(ip, port, hostname) object for the client socket.
request_line=  
The complete Request-Line received from the client. This is a single string consisting of the request
method, URI, and protocol version (joined by spaces). Any final CRLF is removed.
respond(path_info)
Generate a response for the resource at self.path_info. (Core)
rfile= None
If the request included an entity (body), it will be available as a stream in this attribute. However, the rfile
will normally be read for you between the  before_request_body hook and the  before_handler hook, and
the resulting string is placed into either request.params or the request.body attribute.
You may disable the automatic consumption of the rfile by setting request.process_request_body to False,
either in config for the desired path, or in an  on_start_resource or  before_request_body hook.
WARNING: In almost every case, you should not attempt to read from the rfile stream after CherryPy s
automatic mechanism has read it. If you turn off the automatic parsing of rfile, you should read exactly the
number of bytes specified in request.headers[ Content-Length ]. Ignoring either of these warnings may
result in a hung request thread or in corruption of the next (pipelined) request.
run(method, path, query_string, req_protocol, headers, rfile)
Process the Request. (Core)
method, path, query_string, and req_protocol should be pulled directly from the Request-Line (e.g.  GET
/path?key=val HTTP/1.0 ).
path This should be %XX-unquoted, but query_string should not be.
When using Python 2, they both MUST be byte strings, not unicode strings.
When using Python 3, they both MUST be unicode strings, not byte strings, and preferably not bytes
x00-xFF disguised as unicode.
headers A list of (name, value) tuples.
rfile A file-like object containing the HTTP request entity.
When run() is done, the returned object should have 3 attributes:
110 Chapter 7. Reference Manual
CherryPy Documentation, Release 3.2.4
" status, e.g.  200 OK
" header_list, a list of (name, value) tuples
" body, an iterable yielding strings
Consumer code (HTTP servers) should then access these response attributes to build the outbound stream.
scheme=  http
The protocol used between client and server. In most cases, this will be either  http or  https .
script_name=  
The  mount point of the application which is handling this request.
This attribute MUST NOT end in a slash. If the script_name refers to the root of the URI, it MUST be an
empty string (not  / ).
server_protocol=  HTTP/1.1
The HTTP version for which the HTTP server is at least conditionally compliant.
show_mismatched_params= True
If True, mismatched parameters encountered during PageHandler invocation processing will be included
in the response body.
show_tracebacks= True
If True, unexpected errors encountered during request processing will include a traceback in the response
body.
stage= None
A string containing the stage reached in the request-handling process. This is useful when debugging a
live server with hung requests.
throw_errors= False
If True, Request.run will not trap any errors (except HTTPRedirect and HTTPError, which are more prop-
erly called  exceptions , not errors).
throws= (, ,
The sequence of exceptions which Request.run does not trap.
toolmaps= {}
A nested dict of all Toolboxes and Tools in effect for this request, of the form: {Toolbox.namespace:
{Tool.name: config dict}}.
classcherrypy._cprequest.Response
An HTTP Response, including status, headers, and body.
body
The body (entity) of the HTTP response.
check_timeout()
If now > self.time + self.timeout, set self.timed_out.
This purposefully sets a flag, rather than raising an error, so that a monitor thread can interrupt the Response
thread.
collapse_body()
Collapse self.body to a single string; replace it and return it.
cookie=
See help(Cookie).
finalize()
Transform headers (and cookies) into self.header_list. (Core)
7.7. cherrypy._cprequest 111
CherryPy Documentation, Release 3.2.4
header_list= []
A list of the HTTP response headers as (name, value) tuples. In general, you should use response.headers
(a dict) instead. This attribute is generated from response.headers and is not valid until after the finalize
phase.
headers= {}
A dict-like object containing the response headers. Keys are header names (in Title-Case format); how-
ever, you may get and set them in a case-insensitive manner. That is, headers[ Content-Type ] and
headers[ content-type ] refer to the same value. Values are header values (decoded according to RFC
2047 if necessary).
See Also:
classesHeaderMap,HeaderElement
status=  
The HTTP Status-Code and Reason-Phrase.
stream= False
If False, buffer the response body.
time= None
The value of time.time() when created. Use in HTTP dates.
timed_out= False
Flag to indicate the response should be aborted, because it has exceeded its timeout.
timeout= 300
Seconds after which the response will be aborted.
classcherrypy._cprequest.Hook(callback, failsafe=None, priority=None, **kwargs)
A callback and its metadata: failsafe, priority, and kwargs.
callback= None
The bare callable that this Hook object is wrapping, which will be called when the Hook is called.
failsafe= False
If True, the callback is guaranteed to run even if other callbacks from the same call point raise exceptions.
kwargs= {}
A set of keyword arguments that will be passed to the callable on each call.
priority= 50 [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • zboralski.keep.pl