![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | get_path |
def | set_path |
def | set_url |
def | get |
def | get_all |
def | get_range |
def | set |
def | relative_url |
def | update_properties |
def | arguments |
Public Attributes | |
method | |
scheme | |
host | |
params | |
params_list | |
headers | |
body | |
url | |
path_qs | |
query_string | |
environ | |
remote_addr | |
Properties | |
uri = property(lambda self: self.url) | |
path = property(get_path, set_path) | |
Mocks out webapp.Request. Use get()/set() to configure the query parameters for the request. Public Members: method: A string representing the request type. Defaults to 'GET'. uri: A string representing the requested URI. Defaults to '/start'.
def google.appengine.ext.webapp.mock_webapp.MockRequest.__init__ | ( | self | ) |
Initializer.
def google.appengine.ext.webapp.mock_webapp.MockRequest.arguments | ( | self | ) |
Gets the set of argument names used in this request.
def google.appengine.ext.webapp.mock_webapp.MockRequest.get | ( | self, | |
argument_name, | |||
default_value = '' , |
|||
allow_multiple = False |
|||
) |
Looks up the value of a query parameter. Args: argument_name: The query parameter key as a string. default_value: The default query parameter value as a string if it was not supplied. allow_multiple: return a list of values with the given name Returns: If allow_multiple is False (which it is by default), we return the first value with the given name given in the request. If it is True, we always return an list.
def google.appengine.ext.webapp.mock_webapp.MockRequest.get_all | ( | self, | |
argument_name | |||
) |
Returns a list of query parameters with the given name. Args: argument_name: the name of the query argument. Returns: A (possibly empty) list of values.
def google.appengine.ext.webapp.mock_webapp.MockRequest.get_range | ( | self, | |
name, | |||
min_value = None , |
|||
max_value = None , |
|||
default = 0 |
|||
) |
Parses the given int argument, limiting it to the given range. Args: name: the name of the argument min_value: the minimum int value of the argument (if any) max_value: the maximum int value of the argument (if any) default: the default value of the argument if it is not given Returns: An int within the given range for the argument
def google.appengine.ext.webapp.mock_webapp.MockRequest.relative_url | ( | self, | |
other_url, | |||
to_application = False |
|||
) |
Return an absolute (!) URL by combining self.path with other_url.
def google.appengine.ext.webapp.mock_webapp.MockRequest.set | ( | self, | |
argument_name, | |||
value | |||
) |
Sets the value of a query parameter. Args: argument_name: The string name of the query parameter. value: The string value of the query parameter. Pass None to remove query parameter.
def google.appengine.ext.webapp.mock_webapp.MockRequest.set_url | ( | self, | |
url | |||
) |
Set full URL for the request. Parses the URL and sets path, scheme, host and parameters correctly.
def google.appengine.ext.webapp.mock_webapp.MockRequest.update_properties | ( | self | ) |
Update url, path_qs property to be in sync with path and params.