webob – Request/Response objects
Request
-
class
webob.request.BaseRequest(environ, charset=None, unicode_errors=None, decode_param_names=None, **kw) -
GET Return a MultiDict containing all the variables from the QUERY_STRING.
-
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 & PATCH requests with an appropriate Content-Type are also supported.
-
ResponseClass alias of
Response
-
accept Gets and sets the
Acceptheader (HTTP spec section 14.1).
-
accept_charset Gets and sets the
Accept-Charsetheader (HTTP spec section 14.2).
-
accept_encoding Gets and sets the
Accept-Encodingheader (HTTP spec section 14.3).
-
accept_language Gets and sets the
Accept-Languageheader (HTTP spec section 14.4).
-
application_url The URL including SCRIPT_NAME (no PATH_INFO or query string)
-
as_bytes(skip_body=False) Return HTTP bytes 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.
Gets and sets the
Authorizationheader (HTTP spec section 14.8). Converts it usingparse_authandserialize_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__.
-
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.inputkey 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.
-
client_addr The effective client IP address as a string. If the
HTTP_X_FORWARDED_FORheader exists in the WSGI environ, this attribute returns the client IP address present in that header (e.g. if the header value is192.168.1.1, 192.168.1.2, the value will be192.168.1.1). If noHTTP_X_FORWARDED_FORheader is present in the environ at all, this attribute will return the value of theREMOTE_ADDRheader. If theREMOTE_ADDRheader is unset, this attribute will return the valueNone.Warning
It is possible for user agents to put someone else’s IP or just any string in
HTTP_X_FORWARDED_FORas it is a normal HTTP header. Forward proxies can also provide incorrect values (private IP addresses etc). You cannot “blindly” trust the result of this method to provide you with valid data unless you’re certain thatHTTP_X_FORWARDED_FORhas the correct values. The WSGI server must be behind a trusted proxy for this to be true.
-
content_length Gets and sets the
Content-Lengthheader (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.
Return a dictionary of cookies as found in the request.
-
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 BytesIO 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
Dateheader (HTTP spec section 14.8). Converts it using HTTP date.
-
domain Returns the domain portion of the host value. Equivalent to:
domain = request.host if ':' in domain: domain = domain.split(':', 1)[0]
This will be equivalent to the domain portion of the
HTTP_HOSTvalue in the environment if it exists, or theSERVER_NAMEvalue in the environment if it doesn’t. For example, if the environment contains anHTTP_HOSTvalue offoo.example.com:8000,request.domainwill returnfoo.example.com.Note that this value cannot be set on the request. To set the host value use
webob.request.Request.host()instead.
-
classmethod
from_bytes(b) Create a request from HTTP bytes data. If the bytes contain extra data after the request, raise a ValueError.
-
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.
-
get_response(application=None, catch_exc_info=False) Like
.call_application(application), except returns a response object with.status,.headers, and.bodyattributes.This will use
self.ResponseClassto figure out the class of the response object to return.If
applicationis not given, this will send the request toself.make_default_send_app()
-
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_port The effective server port number as a string. If the
HTTP_HOSTheader exists in the WSGI environ, this attribute returns the port number present in that header. If theHTTP_HOSTheader exists but contains no explicit port number: if the WSGI url scheme is “https” , this attribute returns “443”, if the WSGI url scheme is “http”, this attribute returns “80” . If noHTTP_HOSTheader is present in the environ at all, this attribute will return the value of theSERVER_PORTheader (which is guaranteed to be present).
-
host_url The URL through the host (no path)
-
http_version Gets and sets the
SERVER_PROTOCOLkey in the environment.
-
if_match Gets and sets the
If-Matchheader (HTTP spec section 14.24). Converts it as a Etag.
-
if_modified_since Gets and sets the
If-Modified-Sinceheader (HTTP spec section 14.25). Converts it using HTTP date.
-
if_none_match Gets and sets the
If-None-Matchheader (HTTP spec section 14.26). Converts it as a Etag.
-
if_range Gets and sets the
If-Rangeheader (HTTP spec section 14.27). Converts it using IfRange object.
-
if_unmodified_since Gets and sets the
If-Unmodified-Sinceheader (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_seekablekey in the environment.
-
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.
-
json Access the body of the request as JSON
-
json_body Access the body of the request as JSON
-
make_body_seekable() This forces
environ['wsgi.input']to be seekable. That means that, the content is copied into a BytesIO 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 BytesIO 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-Forwardsheader (HTTP spec section 14.31). Converts it using int.
-
method Gets and sets the
REQUEST_METHODkey in the environment.
-
params A dictionary-like object containing both the parameters from the query string and request body.
-
path The path of the request, without host or query string
-
path_info Gets and sets the
PATH_INFOkey 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
patternargument 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
Pragmaheader (HTTP spec section 14.32).
-
query_string Gets and sets the
QUERY_STRINGkey in the environment.
-
range Gets and sets the
Rangeheader (HTTP spec section 14.35). Converts it using Range object.
-
referer Gets and sets the
Refererheader (HTTP spec section 14.36).
-
referrer Gets and sets the
Refererheader (HTTP spec section 14.36).
-
relative_url(other_url, to_application=False) Resolve other_url relative to the request URL.
If
to_applicationis True, then resolve it relative to the URL with only SCRIPT_NAME
-
remote_addr Gets and sets the
REMOTE_ADDRkey in the environment.
-
remote_user Gets and sets the
REMOTE_USERkey 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.
-
scheme Gets and sets the
wsgi.url_schemekey in the environment.
-
script_name Gets and sets the
SCRIPT_NAMEkey in the environment.
-
send(application=None, catch_exc_info=False) Like
.call_application(application), except returns a response object with.status,.headers, and.bodyattributes.This will use
self.ResponseClassto figure out the class of the response object to return.If
applicationis not given, this will send the request toself.make_default_send_app()
-
server_name Gets and sets the
SERVER_NAMEkey in the environment.
-
server_port Gets and sets the
SERVER_PORTkey in the environment. Converts it using int.
-
str_GET <Deprecated attribute None>
-
str_POST <Deprecated attribute None>
<Deprecated attribute None>
-
str_params <Deprecated attribute None>
-
text Get/set the text value of the body
-
upath_info Gets and sets the
PATH_INFOkey in the environment.
-
url The full request URL, including QUERY_STRING
-
url_encoding Gets and sets the
webob.url_encodingkey in the environment.
-
urlargs Return any positional variables matched in the URL.
Takes values from
environ['wsgiorg.routing_args']. Systems likeroutesset this value.
-
urlvars Return any named variables matched in the URL.
Takes values from
environ['wsgiorg.routing_args']. Systems likeroutesset this value.
-
uscript_name Gets and sets the
SCRIPT_NAMEkey in the environment.
-
user_agent Gets and sets the
User-Agentheader (HTTP spec section 14.43).
-
Response
-
class
webob.response.Response(body=None, status=None, headerlist=None, app_iter=None, content_type=None, conditional_response=None, **kw) Represents a WSGI response
-
accept_ranges Gets and sets the
Accept-Rangesheader (HTTP spec section 14.5).
-
age Gets and sets the
Ageheader (HTTP spec section 14.6). Converts it using int.
-
allow Gets and sets the
Allowheader (HTTP spec section 14.7). Converts it using list.
-
app_iter Returns the app_iter of the response.
If body was set, this will create an app_iter from that body (a single-item list)
-
app_iter_range(start, stop) Return a new app_iter built from the response app_iter, that serves up only the given
start:stoprange.
-
body The body of the response, as a
str. This will read in the entire app_iter if necessary.
-
body_file A file-like object that can be used to write to the body. If you passed in a list app_iter, that app_iter will be modified by writes.
-
cache_control Get/set/modify the Cache-Control header (HTTP spec section 14.9)
-
charset Get/set the charset (in the Content-Type)
-
conditional_response_app(environ, start_response) Like the normal __call__ interface, but checks conditional headers:
- If-Modified-Since (304 Not Modified; only on GET, HEAD)
- If-None-Match (304 Not Modified; only on GET, HEAD)
- Range (406 Partial Content; only on GET, HEAD)
-
content_disposition Gets and sets the
Content-Dispositionheader (HTTP spec section 19.5.1).
-
content_encoding Gets and sets the
Content-Encodingheader (HTTP spec section 14.11).
-
content_language Gets and sets the
Content-Languageheader (HTTP spec section 14.12). Converts it using list.
-
content_length Gets and sets the
Content-Lengthheader (HTTP spec section 14.17). Converts it using int.
-
content_location Gets and sets the
Content-Locationheader (HTTP spec section 14.14).
-
content_md5 Gets and sets the
Content-MD5header (HTTP spec section 14.14).
-
content_range Gets and sets the
Content-Rangeheader (HTTP spec section 14.16). Converts it using ContentRange object.
-
content_type Get/set the Content-Type header (or None), without the charset or any parameters.
If you include parameters (or
;at all) when setting the content_type, any existing parameters will be deleted; otherwise they will be preserved.
-
content_type_params A dictionary of all the parameters in the content type.
(This is not a view, set to change, modifications of the dict would not be applied otherwise)
-
copy() Makes a copy of the response
-
date Gets and sets the
Dateheader (HTTP spec section 14.18). Converts it using HTTP date.
Delete a cookie from the client. Note that path and domain must match how the cookie was originally set.
This sets the cookie to the empty string, and max_age=0 so that it should expire immediately.
-
encode_content(encoding='gzip', lazy=False) Encode the content with the given encoding (only gzip and identity are supported).
-
etag Gets and sets the
ETagheader (HTTP spec section 14.19). Converts it using Entity tag.
-
expires Gets and sets the
Expiresheader (HTTP spec section 14.21). Converts it using HTTP date.
-
classmethod
from_file(fp) Reads a response from a file-like object (it must implement
.read(size)and.readline()).It will read up to the end of the response, not the end of the file.
This reads the response as represented by
str(resp); it may not read every valid HTTP response properly. Responses must have aContent-Length
-
headerlist The list of response headers
-
headers The headers in a dictionary-like object
-
json Access the body of the response as JSON
-
json_body Access the body of the response as JSON
-
last_modified Gets and sets the
Last-Modifiedheader (HTTP spec section 14.29). Converts it using HTTP date.
-
location Gets and sets the
Locationheader (HTTP spec section 14.30).
-
md5_etag(body=None, set_content_md5=False) Generate an etag for the response object using an MD5 hash of the body (the body parameter, or
self.bodyif not given)Sets
self.etagIfset_content_md5is True setsself.content_md5as well
Merge the cookies that were set on this response with the given resp object (which can be any WSGI application).
If the resp is a
webob.Responseobject, then the other object will be modified in-place.
-
pragma Gets and sets the
Pragmaheader (HTTP spec section 14.32).
-
retry_after Gets and sets the
Retry-Afterheader (HTTP spec section 14.37). Converts it using HTTP date or delta seconds.
-
server Gets and sets the
Serverheader (HTTP spec section 14.38).
Set (add) a cookie for the response.
Arguments are:
keyThe cookie name.valueThe cookie value, which should be a string orNone. IfvalueisNone, it’s equivalent to calling thewebob.response.Response.unset_cookie()method for this cookie key (it effectively deletes the cookie on the client).max_ageAn integer representing a number of seconds orNone. If this value is an integer, it is used as theMax-Ageof the generated cookie. Ifexpiresis not passed and this value is an integer, themax_agevalue will also influence theExpiresvalue of the cookie (Expireswill be set to now + max_age). If this value isNone, the cookie will not have aMax-Agevalue (unlessexpiresis also sent).pathA string representing the cookiePathvalue. It defaults to/.domainA string representing the cookieDomain, orNone. If domain isNone, noDomainvalue will be sent in the cookie.secureA boolean. If it’sTrue, thesecureflag will be sent in the cookie, if it’sFalse, thesecureflag will not be sent in the cookie.httponlyA boolean. If it’sTrue, theHttpOnlyflag will be sent in the cookie, if it’sFalse, theHttpOnlyflag will not be sent in the cookie.commentA string representing the cookieCommentvalue, orNone. IfcommentisNone, noCommentvalue will be sent in the cookie.expiresAdatetime.timedeltaobject representing an amount of time or the valueNone. A non-Nonevalue is used to generate theExpiresvalue of the generated cookie. Ifmax_ageis not passed, but this value is notNone, it will influence theMax-Ageheader (Max-Agewill be ‘expires_value - datetime.utcnow()’). If this value isNone, theExpirescookie value will be unset (unlessmax_ageis also passed).overwriteIf this key isTrue, before setting the cookie, unset any existing cookie.
-
status The status string
-
status_code The status as an integer
-
status_int The status as an integer
-
text Get/set the text value of the body (using the charset of the Content-Type)
-
ubody Deprecated alias for .text
-
unicode_body Deprecated alias for .text
Unset a cookie with the given name (remove it from the response).
-
vary Gets and sets the
Varyheader (HTTP spec section 14.44). Converts it using list.
-
www_authenticate Gets and sets the
WWW-Authenticateheader (HTTP spec section 14.47). Converts it usingparse_authandserialize_auth.
-
-
class
webob.response.AppIterRange(app_iter, start, stop) Wraps an app_iter, returning just a range of bytes
Headers
Accept-*
Parses a variety of Accept-* headers.
These headers generally take the form of:
value1; q=0.5, value2; q=0
Where the q parameter is optional. In theory other parameters
exists, but this ignores them.
-
class
webob.acceptparse.Accept(header_value) Represents a generic
Accept-*style header.This object should not be modified. To add items you can use
accept_obj + 'accept_thing'to get a new object-
best_match(offers, default_match=None) Returns the best match in the sequence of offered types.
The sequence can be a simple sequence, or you can have
(match, server_quality)items in the sequence. If you have these tuples then the client quality is multiplied by the server_quality to get a total. If two matches have equal weight, then the one that shows up first in the offers list will be returned.But among matches with the same quality the match to a more specific requested type will be chosen. For example a match to text/* trumps /.
default_match (default None) is returned if there is no intersection.
-
first_match(offers) DEPRECATED Returns the first allowed offered type. Ignores quality. Returns the first offered type if nothing else matches; or if you include None at the end of the match list then that will be returned.
-
static
parse(value) Parse
Accept-*style header.Return iterator of
(value, quality)pairs.qualitydefaults to 1.
-
quality(offer, modifier=1) Return the quality of the given offer. Returns None if there is no match (not 0).
-
-
class
webob.acceptparse.MIMEAccept(header_value) Represents the
Acceptheader, which is a list of mimetypes.This class knows about mime wildcards, like
image/*-
accept_html() Returns true if any HTML-like type is accepted
-
accepts_html Returns true if any HTML-like type is accepted
-
Cache-Control
-
class
webob.cachecontrol.CacheControl(properties, type) Represents the Cache-Control header.
By giving a type of
'request'or'response'you can control what attributes are allowed (some Cache-Control values only apply to requests or responses).-
copy() Returns a copy of this object.
-
classmethod
parse(header, updates_to=None, type=None) Parse the header, returning a CacheControl object.
The object is bound to the request or response object
updates_to, if that is given.
-
update_dict alias of
UpdateDict
-
ETag
-
class
webob.etag.ETagMatcher(etags) -
classmethod
parse(value, strong=True) Parse this from a header value
-
classmethod
Cookies
A helper class that helps bring some sanity to the insanity that is cookie handling.
The helper is capable of generating multiple cookies if necessary to support subdomains and parent domains.
cookie_name- The name of the cookie used for sessioning. Default:
'session'. max_age- The maximum age of the cookie used for sessioning (in seconds).
Default:
None(browser scope). secure- The ‘secure’ flag of the session cookie. Default:
False. httponly- Hide the cookie from Javascript by setting the ‘HttpOnly’ flag of the
session cookie. Default:
False. path- The path used for the session cookie. Default:
'/'. domains- The domain(s) used for the session cookie. Default:
None(no domain). Can be passed an iterable containing multiple domains, this will set multiple cookies one for each domain. serializer- An object with two methods:
loadsanddumps. Theloadsmethod should accept a bytestring and return a Python object. Thedumpsmethod should accept a Python object and return bytes. AValueErrorshould be raised for malformed inputs. Default:None, which will use a derivation ofjson.dumps()andjson.loads().
Bind a request to a copy of this instance and return it
Retrieve raw headers for setting cookies.
Returns a list of headers that should be set for the cookies to be correctly tracked.
Looks for a cookie by name in the currently bound request, and returns its value. If the cookie profile is not bound to a request, this method will raise a
ValueError.Looks for the cookie in the cookies jar, and if it can find it it will attempt to deserialize it. Returns
Noneif there is no cookie or if the value in the cookie cannot be successfully deserialized.
Set the cookies on a response.
A helper for generating cookies that are signed to prevent tampering.
By default this will create a single cookie, given a value it will serialize it, then use HMAC to cryptographically sign the data. Finally the result is base64-encoded for transport. This way a remote user can not tamper with the value without uncovering the secret/salt used.
secret- A string which is used to sign the cookie. The secret should be at
least as long as the block size of the selected hash algorithm. For
sha512this would mean a 128 bit (64 character) secret. salt- A namespace to avoid collisions between different uses of a shared secret.
hashalg- The HMAC digest algorithm to use for signing. The algorithm must be
supported by the
hashliblibrary. Default:'sha512'. cookie_name- The name of the cookie used for sessioning. Default:
'session'. max_age- The maximum age of the cookie used for sessioning (in seconds).
Default:
None(browser scope). secure- The ‘secure’ flag of the session cookie. Default:
False. httponly- Hide the cookie from Javascript by setting the ‘HttpOnly’ flag of the
session cookie. Default:
False. path- The path used for the session cookie. Default:
'/'. domains- The domain(s) used for the session cookie. Default:
None(no domain). Can be passed an iterable containing multiple domains, this will set multiple cookies one for each domain. serializer- An object with two methods: loads` and
dumps. Theloadsmethod should accept bytes and return a Python object. Thedumpsmethod should accept a Python object and return bytes. AValueErrorshould be raised for malformed inputs. Default:None`, which will use a derivation of :func:`json.dumps` and ``json.loads.
Bind a request to a copy of this instance and return it
A helper to cryptographically sign arbitrary content using HMAC.
The serializer accepts arbitrary functions for performing the actual serialization and deserialization.
secret- A string which is used to sign the cookie. The secret should be at
least as long as the block size of the selected hash algorithm. For
sha512this would mean a 128 bit (64 character) secret. salt- A namespace to avoid collisions between different uses of a shared secret.
hashalg- The HMAC digest algorithm to use for signing. The algorithm must be
supported by the
hashliblibrary. Default:'sha512'. serializer- An object with two methods: loads` and
dumps. Theloadsmethod should accept bytes and return a Python object. Thedumpsmethod should accept a Python object and return bytes. AValueErrorshould be raised for malformed inputs. Default:None`, which will use a derivation of :func:`json.dumps` and ``json.loads.
Given an
appstruct, serialize and sign the data.Returns a bytestring.
Given a
bstruct(a bytestring), verify the signature and then deserialize and return the deserialized value.A
ValueErrorwill be raised if the signature fails to validate.
A serializer which uses json.dumps` and
json.loads
Generate a cookie value. If
valueis None, generate a cookie value with an expiration date in the past
Misc Functions and Internals
-
webob.html_escape(s) HTML-escape a string or object
This converts any non-string objects passed into it to strings (actually, using
unicode()). All values returned are non-unicode strings (using&#num;entities for all non-ASCII characters).None is treated specially, and returns the empty string.
-
class
webob.headers.ResponseHeaders(*args, **kw) Dictionary view on the response headerlist. Keys are normalized for case and whitespace.
-
class
webob.headers.EnvironHeaders(environ) An object that represents the headers as present in a WSGI environment.
This object is a wrapper (with no internal state) for a WSGI request object, representing the CGI-style HTTP_* keys as a dictionary. Because a CGI environment can only hold one value for each key, this dictionary is single-valued (unlike outgoing headers).
Gives a multi-value dictionary object (MultiDict) plus several wrappers
-
class
webob.multidict.MultiDict(*args, **kw) An ordered dictionary that can have multiple values for each key. Adds the methods getall, getone, mixed and extend and add to the normal dictionary interface.
-
add(key, value) Add the key and value, not overwriting any previous value.
-
dict_of_lists() Returns a dictionary where each key is associated with a list of values.
-
classmethod
from_fieldstorage(fs) Create a dict from a cgi.FieldStorage instance
-
getall(key) Return a list of all values matching the key (may be an empty list)
-
getone(key) Get one value matching the key, raising a KeyError if multiple values were found.
-
mixed() Returns a dictionary where the values are either single values, or a list of values when a key/value appears more than once in this dictionary. This is similar to the kind of dictionary often used to represent the variables in a web request.
-
classmethod
view_list(lst) Create a dict that is a view on the given list
-
-
class
webob.multidict.NestedMultiDict(*dicts) Wraps several MultiDict objects, treating it as one large MultiDict
-
class
webob.multidict.NoVars(reason=None) Represents no variables; used when no variables are applicable.
This is read-only
-
class
webob.cachecontrol.UpdateDict Dict that has a callback on all updates