Fork me on GitHub

webob – Request/Response objects

Request

class webob.Request(environ, charset=None, unicode_errors=None, decode_param_names=None, **kw)

The default request implementation

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

class webob.acceptparse.MIMEAccept(header_value)

Represents the Accept header, which is a list of mimetypes.

This class knows about mime wildcards, like image/*

class webob.byterange.Range(start, end)

Represents the Range header.

Represents the Cache-Control header

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).

Does parsing of ETag-related headers: If-None-Matches, If-Matches

Also If-Range parsing

class webob.etag.ETagMatcher(etags)
class webob.etag.IfRange(etag)

Response

class webob.Response(body=None, status=None, headerlist=None, app_iter=None, content_type=None, conditional_response=None, **kw)

Represents a WSGI response

class webob.byterange.ContentRange(start, stop, length)

Represents the Content-Range header

This header is start-stop/length, where start-stop and length can be * (represented as None in the attributes).

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).

Misc Functions

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.response.AppIterRange(app_iter, start, stop)

Wraps an app_iter, returning just a range of bytes

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.

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

Descriptors

class webob.descriptors.environ_getter
class webob.descriptors.header_getter
class webob.descriptors.converter
class webob.descriptors.deprecated_property

Wraps a descriptor, with a deprecation warning or error

Table Of Contents

Previous topic

webtest – WebTest

Next topic

Glossary

This Page