httplib2 Package

httplib2 Package

class cbtestlib.membase.api.httplib2.Http(cache=None, timeout=None, proxy_info=None)

Bases: object

An HTTP client that handles: - all methods - caching - ETags - compression, - HTTPS - Basic - Digest - WSSE

and more.

add_certificate(key, cert, domain)

Add a key and cert that will be used any time a request requires authentication.

add_credentials(name, password, domain='')

Add a name and password that will be used any time a request requires authentication.

clear_credentials()

Remove all the names and passwords that are used for authentication

request(uri, method='GET', body=None, headers=None, redirections=5, connection_type=None)

Performs a single HTTP request. The ‘uri’ is the URI of the HTTP resource and can begin with either ‘http’ or ‘https’. The value of ‘uri’ must be an absolute URI.

The ‘method’ is the HTTP method to perform, such as GET, POST, DELETE, etc. There is no restriction on the methods allowed.

The ‘body’ is the entity body to be sent with the request. It is a string object.

Any extra headers that are to be sent with the request should be provided in the ‘headers’ dictionary.

The maximum number of redirect to follow before raising an exception is ‘redirections. The default is 5.

The return value is a tuple of (response, content), the first being and instance of the ‘Response’ class, the second being a string that contains the response entity body.

class cbtestlib.membase.api.httplib2.Response(info)

Bases: dict

An object more like email.Message than httplib.HTTPResponse.

fromcache = False

HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1.

previous = None
reason = 'Ok'
status = 200

Reason phrase returned by server.

version = 11

Status code returned by server.

class cbtestlib.membase.api.httplib2.ProxyInfo(proxy_type, proxy_host, proxy_port, proxy_rdns=None, proxy_user=None, proxy_pass=None)

Bases: object

Collect information required to use a proxy.

astuple()
isgood()
exception cbtestlib.membase.api.httplib2.HttpLib2Error

Bases: exceptions.Exception

exception cbtestlib.membase.api.httplib2.RedirectMissingLocation(desc, response, content)

Bases: cbtestlib.membase.api.httplib2.HttpLib2ErrorWithResponse

exception cbtestlib.membase.api.httplib2.RedirectLimit(desc, response, content)

Bases: cbtestlib.membase.api.httplib2.HttpLib2ErrorWithResponse

exception cbtestlib.membase.api.httplib2.FailedToDecompressContent(desc, response, content)

Bases: cbtestlib.membase.api.httplib2.HttpLib2ErrorWithResponse

exception cbtestlib.membase.api.httplib2.UnimplementedDigestAuthOptionError(desc, response, content)

Bases: cbtestlib.membase.api.httplib2.HttpLib2ErrorWithResponse

exception cbtestlib.membase.api.httplib2.UnimplementedHmacDigestAuthOptionError(desc, response, content)

Bases: cbtestlib.membase.api.httplib2.HttpLib2ErrorWithResponse

iri2uri Module

iri2uri

Converts an IRI to a URI.

cbtestlib.membase.api.httplib2.iri2uri.encode(c)
cbtestlib.membase.api.httplib2.iri2uri.iri2uri(uri)

Convert an IRI to a URI. Note that IRIs must be passed in a unicode strings. That is, do not utf-8 encode the IRI before passing it into the function.

Table Of Contents

Previous topic

api Package

Next topic

helper Package

This Page