Handler of HTTP requasts and responses.
Bases: object
A class handling HTTP requests.
Methods
get(name) | Get value of request. |
has(name) | Ask whether request has name. |
Get value of request.
Parameters: | name: str
|
---|---|
Returns: | str
|
Raises: | KeyError
|
Ask whether request has name.
Parameters: | name: str
|
---|---|
Returns: | bool |
Bases: object
The class handring Response of HTTP.
You can use this class by making instance of this class before sending Response.
Examples
>>> res = Response("json")
>>> res.set_body("{'exit_code' : 0}")
>>> print(res)
>>> res = Response("html")
>>> res.set_body('''
... <!DOCTYPE html>
... <html>
... <body>
... <h1>My Home Page!</h1>
... </body>
... </html>
... ''')
>>> print(res)
Methods
get_header(name) | Get the header which already set and return object. |
make_output([timestamp]) | Make Response text including header and text and return str. |
set_body(bodystr) | Set the body of response. |
set_header(name, value) | Set header of Response. |
Get the header which already set and return object.
Make Response text including header and text and return str.
Set the body of response.
See Examples of this class.
Set header of Response.