Define the Serve serving BE Storage over HTTP.
libbe.storage.http : the associated client
WSGI middleware for managing users (changing passwords, usernames, etc.).
Methods
admin(environ, start_response) | |
data_get_boolean(data, key[, default, source]) | |
data_get_id(data[, key, default, source]) | |
data_get_string(data, key[, default, source]) | |
error(environ, start_response, error, message) | Make it easy to call start_response for errors. |
is_head(environ) | |
log_request(environ[, status, bytes]) | |
ok_response(environ, start_response, content) | |
post_data(environ) | |
query_data(environ) |
WSGI middleware for handling user authentication.
Methods
authenticate(environ) | Handle user-authentication sent in the “Authorization” header. |
authfunc(environ, username, password) | |
error(environ, start_response, error, message) | Make it easy to call start_response for errors. |
log_request(environ[, status, bytes]) |
Handle user-authentication sent in the “Authorization” header.
This function implements Basic authentication as described in HTTP/1.0 specification [R1] . Do not use this module unless you are using SSL, as it transmits unencrypted passwords.
[R1] | http://www.w3.org/Protocols/HTTP/1.0/draft-ietf-http-spec.html#BasicAA |
Notes
Code based on authkit/authenticate/basic.py (c) 2005 Clark C. Evans. Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
Examples
>>> users = Users()
>>> users.add_user(User('Aladdin', 'Big Al', password='open sesame'))
>>> app = AuthenticationApp(app=None, realm='Dummy Realm', users=users)
>>> app.authenticate({'HTTP_AUTHORIZATION':'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='})
'Aladdin'
>>> app.authenticate({'HTTP_AUTHORIZATION':'Basic AAAAAAAAAAAAAAAAAAAAAAAAAA=='})
Some servers (e.g. cherrypy) eat app-raised exceptions.
Work around that by logging tracebacks by hand.
Methods
error(environ, start_response, error, message) | Make it easy to call start_response for errors. |
log_request(environ[, status, bytes]) |
Command wrapper around ServerApp.
Methods
cleanup() | |
complete([argument, fragment]) | |
help(*args) | |
run([options, args]) | |
usage() |
WSGI server for a BE Storage instance over HTTP.
RESTful WSGI request handler for serving the libbe.storage.http.HTTP backend with GET, POST, and HEAD commands. For more information on authentication and REST, see John Calcote’s Open Sourcery article
This serves files from a connected storage instance, usually a VCS-based repository located on the local machine.
Notes
The GET and HEAD requests are identical except that the HEAD request omits the actual content of the file.
Methods
add(environ, start_response) | |
ancestors(environ, start_response) | |
changed(environ, start_response) | |
check_login(environ) | |
children(environ, start_response) | |
commit(environ, start_response) | |
data_get_boolean(data, key[, default, source]) | |
data_get_id(data[, key, default, source]) | |
data_get_string(data, key[, default, source]) | |
error(environ, start_response, error, message) | Make it easy to call start_response for errors. |
exists(environ, start_response) | |
get(environ, start_response) | |
is_head(environ) | |
log_request(environ[, status, bytes]) | |
ok_response(environ, start_response, content) | |
post_data(environ) | |
query_data(environ) | |
remove(environ, start_response) | |
revision_id(environ, start_response) | |
set(environ, start_response) | |
version(environ, start_response) |
WSGI middleware that uppercases incoming HTTP headers.
From PEP 333, The start_response() Callable :
A reminder for server/gateway authors: HTTP header names are case-insensitive, so be sure to take that into consideration when examining application-supplied headers!
Methods
error(environ, start_response, error, message) | Make it easy to call start_response for errors. |
log_request(environ[, status, bytes]) |
Methods
from_string(string) | |
hash(password) | |
set_name(name) | |
set_password(password) | |
valid_login(password) |
Methods
add_user(user) | |
clear(() -> None. Remove all items from D.) | |
copy(() -> a shallow copy of D) | |
fromkeys(...) | v defaults to None. |
get((k[,d]) -> D[k] if k in D, ...) | |
has_key((k) -> True if D has a key k, else False) | |
items(() -> list of D’s (key, value) pairs, ...) | |
iteritems(() -> an iterator over the (key, ...) | |
iterkeys(() -> an iterator over the keys of D) | |
itervalues(...) | |
keys(() -> list of D’s keys) | |
load() | |
pop((k[,d]) -> v, ...) | If key is not found, d is returned if given, otherwise KeyError is raised |
popitem(() -> (k, v), ...) | 2-tuple; but raise KeyError if D is empty. |
save() | |
setdefault((k[,d]) -> D.get(k,d), ...) | |
update(([E, ...) | If E present and has a .keys() method, does: for k in E: D[k] = E[k] |
valid_login(uname, password) | |
values(() -> list of D’s values) | |
viewitems(...) | |
viewkeys(...) | |
viewvalues(...) |
Useful WSGI utilities for handling data (POST, QUERY) and returning responses.
Methods
data_get_boolean(data, key[, default, source]) | |
data_get_id(data[, key, default, source]) | |
data_get_string(data, key[, default, source]) | |
error(environ, start_response, error, message) | Make it easy to call start_response for errors. |
is_head(environ) | |
log_request(environ[, status, bytes]) | |
ok_response(environ, start_response, content) | |
post_data(environ) | |
query_data(environ) |
Utility class for WGSI clients and middleware.
For details on WGSI, see PEP 333
Methods
error(environ, start_response, error, message) | Make it easy to call start_response for errors. |
log_request(environ[, status, bytes]) |
Make it easy to call start_response for errors.
Create a certificate request.
Returns the certificate request in an X509Req object.
Parameters : | pkey : PKey
digest : “md5” or ?
`**name` : :
|
---|
Generate a certificate given a certificate request.
Returns the signed certificate in an X509 object.
Parameters : | req : :
issuerCert : :
issuerKey : :
serial : :
notBefore : :
notAfter : :
digest : :
|
---|
Create a public/private key pair.
Returns the public/private key pair in a PKey object.
Parameters : | type : TYPE_RSA or TYPE_DSA
bits : int
|
---|
Generate private key and certification filenames. get_cert_filenames(server_name) -> (pkey_filename, cert_filename)
Generate private key and certification files.
mk_certs(server_name) -> (pkey_filename, cert_filename)