BaseRequest
¶
-
class
seshat.request.
FileObject
(file_obj)[source]¶ Provides a File like object which supports the common file operations, along with providing some additional metadata which is sent from the client.
-
class
seshat.request.
BaseRequest
(env)[source]¶ Represents the request from the server, and contains various information and utilities. Also the place to store the session object.
The name of the cookie
-
url
= None¶ A urlparse result of the requests path
-
method
= None¶ The HTTP method by which the request was made, in all caps.
-
remote
= None¶ The clients IP, otherwise Unknown IP
-
user_agent
= None¶ The user agent, unparsed, or the string Unknown User Agent
-
referer
= None¶ The referal URL if it exists, otherwise an empty string.
-
get_param
(parameter, default='', cast=<type 'str'>)[source]¶ Allows you to get a parameter from the request. If the parameter does not exist, or is empty, then a default will be returned. You can also choose to optionally cast the parameter.
If a parameter has multiple values then this will return a list of all those values.
Parameters: - parameter – The name of the parameter to get
- default – The default to return if the parameter is nonexistent or empty
- cast – An optional cast for the parameter.
-
get_file
(name)[source]¶ Along with getting parameters, one may wish to retrieve other data such as files sent.
This provides an interface for getting a file like
FileObject
which can be used like a normal file but also holds some meta data sent with the request. If no file by the given name is found then this will return None
-
build_session
()[source]¶ Called during the objects instantiation. Override to set the requests session property.