libbe.storage.http

Define an HTTP-based VersionedStorage implementation.

See Also

libbe.command.serve : the associated server

class libbe.storage.http.HTTP(repo, *args, **kwargs)

VersionedStorage implementation over HTTP.

Uses GET to retrieve information and POST to set information.

Methods

add
ancestors
changed
check_storage_version
children
commit
connect
destroy
disconnect
exists
get
get_post_url(url[, get, data_dict, headers]) Execute a GET or POST transaction.
init
is_readable
is_writeable
parse_repo
recursive_remove
remove
revision_id
set
storage_version
version
changed(revision=None)
check_storage_version()
get_post_url(url, get=True, data_dict=None, headers=[])
parse_repo(repo)

Grab username and password (if any) from the repo URL.

Examples

>>> s = HTTP('http://host.com/path/to/repo')
>>> s.repo
'http://host.com/path/to/repo'
>>> s.uname == None
True
>>> s.password == None
True
>>> s.parse_repo('http://joe:secret@host.com/path/to/repo')
('http://host.com/path/to/repo', 'joe', 'secret')
revision_id(index=None)

Return the name of the <index>th revision.

The choice of which branch to follow when crossing branches/merges is not defined. Revision indices start at 1; ID 0 is the blank repository.

Return None if index==None.

Raises :

InvalidRevision :

If the specified revision does not exist.

storage_version(revision=None)
libbe.storage.http.HTTP_USER_ERROR

Status returned to indicate exceptions on the server side.

A BE-specific extension to the HTTP/1.1 protocol (See RFC 2616).

exception libbe.storage.http.InvalidURL(error=None, url=None, msg=None)
libbe.storage.http.get_post_url(url, get=True, data_dict=None, headers=[])

Execute a GET or POST transaction.

Parameters :

url : str

The base URL (query portion added internally, if necessary).

get : bool

Use GET if True, otherwise use POST.

data_dict : dict

Data to send, either by URL query (if GET) or by POST (if POST).

headers : list

Extra HTTP headers to add to the request.

Table Of Contents

This Page