> Read the latest version of this page
Edit me on GitHub

pyramid.request

class Request(environ, charset=(No Default), unicode_errors=(No Default), decode_param_names=(No Default), **kw)[source]

A subclass of the WebOb Request class. An instance of this class is created by the router and is provided to a view callable (and to other subsystems) as the request argument.

The documentation below (save for the add_response_callback and add_finished_callback methods, which are defined in this subclass itself, and the attributes context, registry, root, subpath, traversed, view_name, virtual_root , and virtual_root_path, each of which is added to the request by the router at request ingress time) are autogenerated from the WebOb source code used when this documentation was generated.

Due to technical constraints, we can’t yet display the WebOb version number from which this documentation is autogenerated, but it will be the ‘prevailing WebOb version’ at the time of the release of this Pyramid version. See http://pythonpaste.org/webob/ for further information.

context

The context will be available as the context attribute of the request object. It will be the context object implied by the current request. See Traversal for information about context objects.

registry

The application registry will be available as the registry attribute of the request object. See Using the Zope Component Architecture in Pyramid for more information about the application registry.

root

The root object will be available as the root attribute of the request object. It will be the resource object at which traversal started (the root). See Traversal for information about root objects.

subpath

The traversal subpath will be available as the subpath attribute of the request object. It will be a sequence containing zero or more elements (which will be Unicode objects). See Traversal for information about the subpath.

traversed

The “traversal path” will be available as the traversed attribute of the request object. It will be a sequence representing the ordered set of names that were used to traverse to the context, not including the view name or subpath. If there is a virtual root associated with the request, the virtual root path is included within the traversal path. See Traversal for more information.

view_name

The view name will be available as the view_name attribute of the request object. It will be a single string (possibly the empty string if we’re rendering a default view). See Traversal for information about view names.

virtual_root

The virtual root will be available as the virtual_root attribute of the request object. It will be the virtual root object implied by the current request. See Virtual Hosting for more information about virtual roots.

virtual_root_path

The virtual root path will be available as the virtual_root_path attribute of the request object. It will be a sequence representing the ordered set of names that were used to traverse to the virtual root object. See Virtual Hosting for more information about virtual roots.

exception

If an exception was raised by a root factory or a view callable, or at various other points where Pyramid executes user-defined code during the processing of a request, the exception object which was caught will be available as the exception attribute of the request within a exception view, a response callback or a finished callback. If no exception occurred, the value of request.exception will be None within response and finished callbacks.

response[source]

This attribute is actually a “reified” property which returns an instance of the pyramid.response.Response class. The response object returned does not exist until this attribute is accessed. Once it is accessed, subsequent accesses to this request object will return the same Response object.

The request.response API can is used by renderers. A render obtains the response object it will return from a view that uses that renderer by accessing request.response. Therefore, it’s possible to use the request.response API to set up a response object with “the right” attributes (e.g. by calling request.response.set_cookie(...) or request.response.content_type = 'text/plain', etc) within a view that uses a renderer. For example, within a view that uses a renderer:

response = request.response
response.set_cookie('mycookie', 'mine, all mine!')
return {'text':'Value that will be used by the renderer'}

Mutations to this response object will be preserved in the response sent to the client after rendering. For more information about using request.response in conjunction with a renderer, see Varying Attributes of Rendered Responses.

Non-renderer code can also make use of request.response instead of creating a response “by hand”. For example, in view code:

response = request.response
response.body = 'Hello!'
response.content_type = 'text/plain'
return response

Note that the response in this circumstance is not “global”; it still must be returned from the view code if a renderer is not used.

session[source]

If a session factory has been configured, this attribute will represent the current user’s session object. If a session factory has not been configured, requesting the request.session attribute will cause a pyramid.exceptions.ConfigurationError to be raised.

tmpl_context[source]

The template context for Pylons-style applications.

matchdict

If a route has matched during this request, this attribute will be a dictionary containing the values matched by the URL pattern associated with the route. If a route has not matched during this request, the value of this attribute will be None. See The Matchdict.

matched_route

If a route has matched during this request, this attribute will be an obect representing the route matched by the URL pattern associated with the route. If a route has not matched during this request, the value of this attribute will be None. See The Matched Route.

add_response_callback(callback)[source]

Add a callback to the set of callbacks to be called by the router at a point after a response object is successfully created. Pyramid does not have a global response object: this functionality allows an application to register an action to be performed against the response once one is created.

A ‘callback’ is a callable which accepts two positional parameters: request and response. For example:

1
2
3
4
def cache_callback(request, response):
    'Set the cache_control max_age for the response'
    response.cache_control.max_age = 360
request.add_response_callback(cache_callback)

Response callbacks are called in the order they’re added (first-to-most-recently-added). No response callback is called if an exception happens in application code, or if the response object returned by view code is invalid.

All response callbacks are called after the pyramid.events.NewResponse event is sent.

Errors raised by callbacks are not handled specially. They will be propagated to the caller of the Pyramid router application.

See also: Using Response Callbacks.

add_finished_callback(callback)[source]

Add a callback to the set of callbacks to be called unconditionally by the router at the very end of request processing.

callback is a callable which accepts a single positional parameter: request. For example:

1
2
3
4
5
6
7
8
9
import transaction

def commit_callback(request):
    '''commit or abort the transaction associated with request'''
    if request.exception is not None:
        transaction.abort()
    else:
        transaction.commit()
request.add_finished_callback(commit_callback)

Finished callbacks are called in the order they’re added ( first- to most-recently- added). Finished callbacks (unlike response callbacks) are always called, even if an exception happens in application code that prevents a response from being generated.

The set of finished callbacks associated with a request are called very late in the processing of that request; they are essentially the last thing called by the router. They are called after response processing has already occurred in a top-level finally: block within the router request processing code. As a result, mutations performed to the request provided to a finished callback will have no meaningful effect, because response processing will have already occurred, and the request’s scope will expire almost immediately after all finished callbacks have been processed.

Errors raised by finished callbacks are not handled specially. They will be propagated to the caller of the Pyramid router application.

See also: Using Finished Callbacks.

route_url(route_name, *elements, **kw)[source]

Return the URL for the route named route_name, using *elements and **kw as modifiers.

This is a convenience method. The result of calling pyramid.request.Request.route_url() is the same as calling pyramid.url.route_url() with an explicit request parameter.

The pyramid.request.Request.route_url() method calls the pyramid.url.route_url() function using the Request object as the request argument. The route_name, *elements and *kw arguments passed to pyramid.request.Request.route_url() are passed through to pyramid.url.route_url() unchanged and its result is returned.

This call to pyramid.request.Request.route_url():

request.route_url('route_name')

Is completely equivalent to calling pyramid.url.route_url() like this:

from pyramid.url import route_url
route_url('route_name', request)
route_path(route_name, *elements, **kw)[source]

Generates a path (aka a ‘relative URL’, a URL minus the host, scheme, and port) for a named Pyramid route configuration.

This is a convenience method. The result of calling pyramid.request.Request.route_path() is the same as calling pyramid.url.route_path() with an explicit request parameter.

This method accepts the same arguments as pyramid.request.Request.route_url() and performs the same duty. It just omits the host, port, and scheme information in the return value; only the script name, path, query parameters, and anchor data are present in the returned string.

The pyramid.request.Request.route_path() method calls the pyramid.url.route_path() function using the Request object as the request argument. The *elements and *kw arguments passed to pyramid.request.Request.route_path() are passed through to pyramid.url.route_path() unchanged and its result is returned.

This call to pyramid.request.Request.route_path():

request.route_path('foobar')

Is completely equivalent to calling pyramid.url.route_path() like this:

from pyramid.url import route_path
route_path('foobar', request)

See pyramid.url.route_path() for more information

resource_url(resource, *elements, **kw)[source]

Return the URL for the resource object named resource, using *elements and **kw as modifiers.

This is a convenience method. The result of calling pyramid.request.Request.resource_url() is the same as calling pyramid.url.resource_url() with an explicit request parameter.

The pyramid.request.Request.resource_url() method calls the pyramid.url.resource_url() function using the Request object as the request argument. The resource, *elements and *kw arguments passed to pyramid.request.Request.resource_url() are passed through to pyramid.url.resource_url() unchanged and its result is returned.

This call to pyramid.request.Request.resource_url():

request.resource_url(myresource)

Is completely equivalent to calling pyramid.url.resource_url() like this:

from pyramid.url import resource_url
resource_url(resource, request)

Note

For backwards compatibility purposes, this method can also be called as pyramid.request.Request.model_url().

static_url(path, **kw)[source]

Generates a fully qualified URL for a static asset. The asset must live within a location defined via the pyramid.config.Configurator.add_static_view() configuration declaration directive (see Serving Static Assets).

This is a convenience method. The result of calling pyramid.request.Request.static_url() is the same as calling pyramid.url.static_url() with an explicit request parameter.

The pyramid.request.Request.static_url() method calls the pyramid.url.static_url() function using the Request object as the request argument. The *kw arguments passed to pyramid.request.Request.static_url() are passed through to pyramid.url.static_url() unchanged and its result is returned.

This call to pyramid.request.Request.static_url():

request.static_url('mypackage:static/foo.css')

Is completely equivalent to calling pyramid.url.static_url() like this:

from pyramid.url import static_url
static_url('mypackage:static/foo.css', request)

See pyramid.url.static_url() for more information

response_*

In Pyramid 1.0, you could set attributes on a pyramid.request.Request which influenced the behavor of rendered responses (views which use a renderer and which don’t directly return a response). These attributes began with response_, such as response_headerlist. If you needed to influence response values from a view that uses a renderer (such as the status code, a header, the content type, etc) you would set these attributes. See Deprecated Mechanism to Vary Attributes of Rendered Responses for further discussion. As of Pyramid 1.1, assignment to response_* attrs are deprecated. Assigning to one is still supported but will cause a deprecation warning to be emitted, and eventually the feature will be removed. For new code, instead of assigning response_* attributes to the request, use API of the the pyramid.request.Request.response object (exposed to view code as request.response) to influence rendered response behavior.

json_body[source]

This property will return the JSON-decoded variant of the request body. If the request body is not well-formed JSON, or there is no body associated with this request, this property will raise an exception. See also Dealing With A JSON-Encoded Request Body.

GET

Like .str_GET, but decodes values and keys

POST

Like .str_POST, but decodes values and keys

accept

Gets and sets the Accept header (HTTP spec section 14.1).

accept_charset

Gets and sets the Accept-Charset header (HTTP spec section 14.2).

accept_encoding

Gets and sets the Accept-Encoding header (HTTP spec section 14.3).

accept_language

Gets and sets the Accept-Language header (HTTP spec section 14.4).

add_finished_callback(callback)[source]

Add a callback to the set of callbacks to be called unconditionally by the router at the very end of request processing.

callback is a callable which accepts a single positional parameter: request. For example:

1
2
3
4
5
6
7
8
9
import transaction

def commit_callback(request):
    '''commit or abort the transaction associated with request'''
    if request.exception is not None:
        transaction.abort()
    else:
        transaction.commit()
request.add_finished_callback(commit_callback)

Finished callbacks are called in the order they’re added ( first- to most-recently- added). Finished callbacks (unlike response callbacks) are always called, even if an exception happens in application code that prevents a response from being generated.

The set of finished callbacks associated with a request are called very late in the processing of that request; they are essentially the last thing called by the router. They are called after response processing has already occurred in a top-level finally: block within the router request processing code. As a result, mutations performed to the request provided to a finished callback will have no meaningful effect, because response processing will have already occurred, and the request’s scope will expire almost immediately after all finished callbacks have been processed.

Errors raised by finished callbacks are not handled specially. They will be propagated to the caller of the Pyramid router application.

See also: Using Finished Callbacks.

add_response_callback(callback)[source]

Add a callback to the set of callbacks to be called by the router at a point after a response object is successfully created. Pyramid does not have a global response object: this functionality allows an application to register an action to be performed against the response once one is created.

A ‘callback’ is a callable which accepts two positional parameters: request and response. For example:

1
2
3
4
def cache_callback(request, response):
    'Set the cache_control max_age for the response'
    response.cache_control.max_age = 360
request.add_response_callback(cache_callback)

Response callbacks are called in the order they’re added (first-to-most-recently-added). No response callback is called if an exception happens in application code, or if the response object returned by view code is invalid.

All response callbacks are called after the pyramid.events.NewResponse event is sent.

Errors raised by callbacks are not handled specially. They will be propagated to the caller of the Pyramid router application.

See also: Using Response Callbacks.

application_url

The URL including SCRIPT_NAME (no PATH_INFO or query string)

as_string(skip_body=False)

Return HTTP string representing this request. If skip_body is True, exclude the body. If skip_body is an integer larger than one, skip body only if its length is bigger than that number.

authorization

Gets and sets the Authorization header (HTTP spec section 14.8). Converts it using parse_auth and serialize_auth.

classmethod blank(path, environ=None, base_url=None, headers=None, POST=None, **kw)

Create a blank request environ (and Request wrapper) with the given path (path should be urlencoded), and any keys from environ.

The path will become path_info, with any query string split off and used.

All necessary keys will be added to the environ, but the values you pass in will take precedence. If you pass in base_url then wsgi.url_scheme, HTTP_HOST, and SCRIPT_NAME will be filled in from that value.

Any extra keyword will be passed to __init__ (e.g., decode_param_names).

body

Return the content of the request body.

body_file

Input stream of the request (wsgi.input). Setting this property resets the content_length and seekable flag (unlike setting req.body_file_raw).

body_file_raw

Gets and sets the wsgi.input key in the environment.

body_file_seekable

Get the body of the request (wsgi.input) as a seekable file-like object. Middleware and routing applications should use this attribute over .body_file.

If you access this value, CONTENT_LENGTH will also be updated.

cache_control

Get/set/modify the Cache-Control header (HTTP spec section 14.9)

call_application(application, catch_exc_info=False)

Call the given WSGI application, returning (status_string, headerlist, app_iter)

Be sure to call app_iter.close() if it’s there.

If catch_exc_info is true, then returns (status_string, headerlist, app_iter, exc_info), where the fourth item may be None, but won’t be if there was an exception. If you don’t do this and there was an exception, the exception will be raised directly.

charset

Get the charset of the request.

If the request was sent with a charset parameter on the Content-Type, that will be used. Otherwise if there is a default charset (set during construction, or as a class attribute) that will be returned. Otherwise None.

Setting this property after request instantiation will always update Content-Type. Deleting the property updates the Content-Type to remove any charset parameter (if none exists, then deleting the property will do nothing, and there will be no error).

content_length

Gets and sets the Content-Length header (HTTP spec section 14.13). Converts it using int.

content_type

Return the content type, but leaving off any parameters (like charset, but also things like the type in application/atom+xml; type=entry)

If you set this property, you can include parameters, or if you don’t include any parameters in the value then existing parameters will be preserved.

cookies

Like .str_cookies, but decodes values and keys

copy()

Copy the request and environment object.

This only does a shallow copy, except of wsgi.input

copy_body()

Copies the body, in cases where it might be shared with another request object and that is not desired.

This copies the body in-place, either into a StringIO object or a temporary file.

copy_get()

Copies the request and environment object, but turning this request into a GET along the way. If this was a POST request (or any other verb) then it becomes GET, and the request body is thrown away.

date

Gets and sets the Date header (HTTP spec section 14.8). Converts it using HTTP date.

classmethod from_file(fp)

Read a request from a file-like object (it must implement .read(size) and .readline()).

It will read up to the end of the request, not the end of the file (unless the request is a POST or PUT and has no Content-Length, in that case, the entire file is read).

This reads the request as represented by str(req); it may not read every valid HTTP request properly.

classmethod from_string(s)

Create a request from HTTP string. If the string contains extra data after the request, raise a ValueError.

get_response(application, catch_exc_info=False)

Like .call_application(application), except returns a response object with .status, .headers, and .body attributes.

This will use self.ResponseClass to figure out the class of the response object to return.

headers

All the request headers as a case-insensitive dictionary-like object.

host

Host name provided in HTTP_HOST, with fall-back to SERVER_NAME

host_url

The URL through the host (no path)

http_version

Gets and sets the SERVER_PROTOCOL key in the environment.

if_match

Gets and sets the If-Match header (HTTP spec section 14.24). Converts it as a Etag.

if_modified_since

Gets and sets the If-Modified-Since header (HTTP spec section 14.25). Converts it using HTTP date.

if_none_match

Gets and sets the If-None-Match header (HTTP spec section 14.26). Converts it as a Etag.

if_range

Gets and sets the If-Range header (HTTP spec section 14.27). Converts it using IfRange object.

if_unmodified_since

Gets and sets the If-Unmodified-Since header (HTTP spec section 14.28). Converts it using HTTP date.

is_body_readable

webob.is_body_readable is a flag that tells us that we can read the input stream even though CONTENT_LENGTH is missing. This allows FakeCGIBody to work and can be used by servers to support chunked encoding in requests. For background see https://bitbucket.org/ianb/webob/issue/6

is_body_seekable

Gets and sets the webob.is_body_seekable key in the environment.

is_response(ob)[source]

Return True if the object passed as ob is a valid response object, False otherwise.

is_xhr

Is X-Requested-With header present and equal to XMLHttpRequest?

Note: this isn’t set by every XMLHttpRequest request, it is only set if you are using a Javascript library that sets it (or you set the header yourself manually). Currently Prototype and jQuery are known to set this header.

make_body_seekable()

This forces environ['wsgi.input'] to be seekable. That means that, the content is copied into a StringIO or temporary file and flagged as seekable, so that it will not be unnecessarily copied again.

After calling this method the .body_file is always seeked to the start of file and .content_length is not None.

The choice to copy to StringIO is made from self.request_body_tempfile_limit

make_tempfile()

Create a tempfile to store big request body. This API is not stable yet. A ‘size’ argument might be added.

max_forwards

Gets and sets the Max-Forwards header (HTTP spec section 14.31). Converts it using int.

method

Gets and sets the REQUEST_METHOD key in the environment.

model_url(resource, *elements, **kw)

Return the URL for the resource object named resource, using *elements and **kw as modifiers.

This is a convenience method. The result of calling pyramid.request.Request.resource_url() is the same as calling pyramid.url.resource_url() with an explicit request parameter.

The pyramid.request.Request.resource_url() method calls the pyramid.url.resource_url() function using the Request object as the request argument. The resource, *elements and *kw arguments passed to pyramid.request.Request.resource_url() are passed through to pyramid.url.resource_url() unchanged and its result is returned.

This call to pyramid.request.Request.resource_url():

request.resource_url(myresource)

Is completely equivalent to calling pyramid.url.resource_url() like this:

from pyramid.url import resource_url
resource_url(resource, request)

Note

For backwards compatibility purposes, this method can also be called as pyramid.request.Request.model_url().

params

Like .str_params, but decodes values and keys

path

The path of the request, without host or query string

path_info

Gets and sets the PATH_INFO key in the environment.

path_info_peek()

Returns the next segment on PATH_INFO, or None if there is no next segment. Doesn’t modify the environment.

path_info_pop(pattern=None)

‘Pops’ off the next segment of PATH_INFO, pushing it onto SCRIPT_NAME, and returning the popped segment. Returns None if there is nothing left on PATH_INFO.

Does not return '' when there’s an empty segment (like /path//path); these segments are just ignored.

Optional pattern argument is a regexp to match the return value before returning. If there is no match, no changes are made to the request and None is returned.

path_qs

The path of the request, without host but with query string

path_url

The URL including SCRIPT_NAME and PATH_INFO, but not QUERY_STRING

pragma

Gets and sets the Pragma header (HTTP spec section 14.32).

query_string

Gets and sets the QUERY_STRING key in the environment.

range

Gets and sets the Range header (HTTP spec section 14.35). Converts it using Range object.

referer

Gets and sets the Referer header (HTTP spec section 14.36).

referrer

Gets and sets the Referer header (HTTP spec section 14.36).

relative_url(other_url, to_application=False)

Resolve other_url relative to the request URL.

If to_application is True, then resolve it relative to the URL with only SCRIPT_NAME

remote_addr

Gets and sets the REMOTE_ADDR key in the environment.

remote_user

Gets and sets the REMOTE_USER key in the environment.

remove_conditional_headers(remove_encoding=True, remove_range=True, remove_match=True, remove_modified=True)

Remove headers that make the request conditional.

These headers can cause the response to be 304 Not Modified, which in some cases you may not want to be possible.

This does not remove headers like If-Match, which are used for conflict detection.

resource_url(resource, *elements, **kw)[source]

Return the URL for the resource object named resource, using *elements and **kw as modifiers.

This is a convenience method. The result of calling pyramid.request.Request.resource_url() is the same as calling pyramid.url.resource_url() with an explicit request parameter.

The pyramid.request.Request.resource_url() method calls the pyramid.url.resource_url() function using the Request object as the request argument. The resource, *elements and *kw arguments passed to pyramid.request.Request.resource_url() are passed through to pyramid.url.resource_url() unchanged and its result is returned.

This call to pyramid.request.Request.resource_url():

request.resource_url(myresource)

Is completely equivalent to calling pyramid.url.resource_url() like this:

from pyramid.url import resource_url
resource_url(resource, request)

Note

For backwards compatibility purposes, this method can also be called as pyramid.request.Request.model_url().

response[source]

This attribute is actually a “reified” property which returns an instance of the pyramid.response.Response. class. The response object returned does not exist until this attribute is accessed. Once it is accessed, subsequent accesses will return the same Response object.

The request.response API is used by renderers. A render obtains the response object it will return from a view that uses that renderer by accessing request.response. Therefore, it’s possible to use the request.response API to set up a response object with “the right” attributes (e.g. by calling request.response.set_cookie()) within a view that uses a renderer. Mutations to this response object will be preserved in the response sent to the client.

route_path(route_name, *elements, **kw)[source]

Generates a path (aka a ‘relative URL’, a URL minus the host, scheme, and port) for a named Pyramid route configuration.

This is a convenience method. The result of calling pyramid.request.Request.route_path() is the same as calling pyramid.url.route_path() with an explicit request parameter.

This method accepts the same arguments as pyramid.request.Request.route_url() and performs the same duty. It just omits the host, port, and scheme information in the return value; only the script name, path, query parameters, and anchor data are present in the returned string.

The pyramid.request.Request.route_path() method calls the pyramid.url.route_path() function using the Request object as the request argument. The *elements and *kw arguments passed to pyramid.request.Request.route_path() are passed through to pyramid.url.route_path() unchanged and its result is returned.

This call to pyramid.request.Request.route_path():

request.route_path('foobar')

Is completely equivalent to calling pyramid.url.route_path() like this:

from pyramid.url import route_path
route_path('foobar', request)

See pyramid.url.route_path() for more information

route_url(route_name, *elements, **kw)[source]

Return the URL for the route named route_name, using *elements and **kw as modifiers.

This is a convenience method. The result of calling pyramid.request.Request.route_url() is the same as calling pyramid.url.route_url() with an explicit request parameter.

The pyramid.request.Request.route_url() method calls the pyramid.url.route_url() function using the Request object as the request argument. The route_name, *elements and *kw arguments passed to pyramid.request.Request.route_url() are passed through to pyramid.url.route_url() unchanged and its result is returned.

This call to pyramid.request.Request.route_url():

request.route_url('route_name')

Is completely equivalent to calling pyramid.url.route_url() like this:

from pyramid.url import route_url
route_url('route_name', request)
scheme

Gets and sets the wsgi.url_scheme key in the environment.

script_name

Gets and sets the SCRIPT_NAME key in the environment.

server_name

Gets and sets the SERVER_NAME key in the environment.

server_port

Gets and sets the SERVER_PORT key in the environment. Converts it using int.

session[source]

Obtain the session object associated with this request. If a session factory has not been registered during application configuration, a pyramid.exceptions.ConfigurationError will be raised

static_url(path, **kw)[source]

Generates a fully qualified URL for a static asset. The asset must live within a location defined via the pyramid.config.Configurator.add_static_view() configuration declaration directive (see Serving Static Assets).

This is a convenience method. The result of calling pyramid.request.Request.static_url() is the same as calling pyramid.url.static_url() with an explicit request parameter.

The pyramid.request.Request.static_url() method calls the pyramid.url.static_url() function using the Request object as the request argument. The *kw arguments passed to pyramid.request.Request.static_url() are passed through to pyramid.url.static_url() unchanged and its result is returned.

This call to pyramid.request.Request.static_url():

request.static_url('mypackage:static/foo.css')

Is completely equivalent to calling pyramid.url.static_url() like this:

from pyramid.url import static_url
static_url('mypackage:static/foo.css', request)

See pyramid.url.static_url() for more information

str_GET

Return a MultiDict containing all the variables from the QUERY_STRING.

str_POST

Return a MultiDict containing all the variables from a form request. Returns an empty dict-like object for non-form requests.

Form requests are typically POST requests, however PUT requests with an appropriate Content-Type are also supported.

str_cookies

Return a plain dictionary of cookies as found in the request.

str_params

A dictionary-like object containing both the parameters from the query string and request body.

tmpl_context[source]

Template context (for Pylons apps)

upath_info

upath_property(‘PATH_INFO’)

url

The full request URL, including QUERY_STRING

urlargs

Return any positional variables matched in the URL.

Takes values from environ['wsgiorg.routing_args']. Systems like routes set this value.

urlvars

Return any named variables matched in the URL.

Takes values from environ['wsgiorg.routing_args']. Systems like routes set this value.

uscript_name

upath_property(‘SCRIPT_NAME’)

user_agent

Gets and sets the User-Agent header (HTTP spec section 14.43).

Note

For information about the API of a multidict structure (such as that used as request.GET, request.POST, and request.params), see pyramid.interfaces.IMultiDict.

Previous topic

pyramid.renderers

Next topic

pyramid.response