guillotina.request
¶
-
class
guillotina.request.
Request
(scheme, method, path, query_string, raw_headers, client_max_size=1048576, send=None, receive=None, scope=None)¶ Bases:
object
Guillotina specific request type. We store potentially a lot of state onto the request object as it is essential our poor man’s thread local model
-
add_future
(*args, **kwargs)¶ Register a future to be executed after the request has finished.
Parameters: - name – name of future
- fut – future to execute after request
- scope – group the futures to execute different groupings together
- args – arguments to execute future with
- kwargs – kwargs to execute future with
-
can_read_body
¶ Return True if request’s HTTP BODY can be read, False otherwise.
Return type: bool
-
content
¶ Return raw payload stream.
-
execute_futures
(scope='')¶ Execute all the registered futures in a new task
Parameters: scope ( str
) – scoped futures to execute. Leave default for normal behavior
-
get_future
(name, scope='')¶ Get a registered future
Parameters: - name (
str
) – scoped futures to execute. Leave default for normal behavior - scope (
str
) – scope name the future was registered for
- name (
-
headers
¶ A case-insensitive multidict proxy with all headers.
-
host
¶ Hostname of the request.
-
json
(*, loads=<built-in function loads>)¶ Return BODY as JSON.
Return type: Any
-
matchdict
= None¶ Dictionary of matched path parameters on request
-
method
¶ Read only property for getting HTTP method.
The value is upper-cased str like ‘GET’, ‘POST’, ‘PUT’ etc.
Return type: str
-
path
¶ The URL including PATH INFO without the host or scheme.
E.g.,
/app/blog
Return type: str
-
path_qs
¶ The URL including PATH_INFO and the query string.
E.g, /app/blog?id=10
-
query
¶ A multidict with all the variables in the query string.
-
query_string
¶ The query string in the URL.
E.g., id=10
-
raw_headers
¶ A sequence of pairs for all headers.
-
read
()¶ Read request body if present.
Returns bytes object with full request content.
Return type: Union
[bytes
,bytearray
]
-
record
(event_name)¶ Record event on the request
Parameters: event_name ( str
) – name of event
-
text
()¶ Return BODY as text
Return type: str
-
version
¶ Read only property for getting HTTP version of request.
-