bexchange.web package

Submodules

bexchange.web.app module

class bexchange.web.app.Application(backend)[source]

Bases: object

dispatch_request(request, provider)[source]
classmethod from_conf(conf)[source]

create instance from configuration. :param conf: a Properties instance to configure

from

get_backend()[source]
bexchange.web.app.from_conf(conf)[source]

create the entire WSGI application from conf this will wrap the application with necessary middleware

bexchange.web.app.serve(uri, app)[source]

serve the application using werkzeug

bexchange.web.auth module

class bexchange.web.auth.AuthMiddleware(app, authmgr)[source]

Bases: object

WSGI middleware providing authentication. Actual authentication is delegated to an Auth implementation registered as a provider here.

The provider and credentials are extracted using get_credentials().

Parameters:

app – the WSGI application receiving the request if authentication is successful.

authenticate(req)[source]

authenticate a Request

bexchange.web.handler module

bexchange.web.handler.file_arrival(ctx)[source]

Returns if a file with specified source, object type has arrived within limit

Parameters:

ctx (RequestContext) – the request context

Returns:

JsonResponse with status 200 Created and information in body

See doc-rest-cmd-file-arrival for details

bexchange.web.handler.get_server_nodename(ctx)[source]

:returns the server nodename

See doc-rest-cmd-server_info for details

bexchange.web.handler.get_server_publickey(ctx)[source]

:returns the server publickey

See doc-rest-cmd-server_info for details

bexchange.web.handler.get_server_uptime(ctx)[source]

:returns the server uptime

See doc-rest-cmd-server_info for details

bexchange.web.handler.get_statistics(ctx)[source]

Returns the statistics for modules / sources

Parameters:

ctx (RequestContext) – the request context

Returns:

JsonResponse with status 200 Created and information in body

See doc-rest-cmd-get_statistics for details

bexchange.web.handler.list_statistic_ids(ctx)[source]

Returns the statistic ids

Parameters:

ctx (RequestContext) – the request context

Returns:

JsonResponse with status 200 Created and information in body

See list_statistic_ids for details

bexchange.web.handler.post_dex_file(ctx)[source]
bexchange.web.handler.post_file(ctx)[source]

Receive a file from some party

Parameters:

ctx (RequestContext) – the request context

Returns:

JsonResponse with status 200 OK

See store for details

bexchange.web.handler.post_json_message(ctx)[source]

A trigger message used to trigger different jobs from the outside

Parameters:

ctx (RequestContext) – the request context

Returns:

JsonResponse with status 201 Created and metadata in body

Raise:

HttpConflict when file already stored

See post_message for details

bexchange.web.handler.supervise(ctx)[source]

Provides functionality for supervising the node

Parameters:

ctx (RequestContext) – the request context

Returns:

JsonResponse with status 200 Created and information in body

See doc-rest-cmd-file-arrival for details

bexchange.web.routing module

class bexchange.web.routing.DatetimeConverter(url_map)[source]

Bases: BaseConverter

from_python(value)[source]
to_python(value)[source]
class bexchange.web.routing.UuidConverter(url_map)[source]

Bases: BaseConverter

from_python(value)[source]
to_python(value)[source]
bexchange.web.routing.get_handler(handler_str)[source]

bexchange.web.util module

exception bexchange.web.util.HttpBadRequest(description=None, response=None)[source]

Bases: HTTPException

code = 400
exception bexchange.web.util.HttpConflict(description=None, response=None)[source]

Bases: HTTPException

code = 409
exception bexchange.web.util.HttpForbidden(description=None, response=None)[source]

Bases: HTTPException

code = 403
exception bexchange.web.util.HttpNotAcceptable(description=None, response=None)[source]

Bases: HTTPException

code = 406
exception bexchange.web.util.HttpNotFound(description=None, response=None)[source]

Bases: HTTPException

code = 404
exception bexchange.web.util.HttpUnauthorized(challenge)[source]

Bases: HTTPException

401 Unauthorized

Parameters:

challenge – a string to reply in www-authenticate header. If given as a sequence of strings, multiple www-authenticate headers will be set in the response.

code = 401
get_headers(environ, scope=None)[source]

Get a list of headers.

class bexchange.web.util.JsonRequestMixin[source]

Bases: object

Request mixin providing JSON-decoding of request body

get_json_data()[source]

try JSON decoding self.data

Returns:

the decoded data

Raise:

HttpBadRequest if decoding fails

class bexchange.web.util.JsonResponse(response, status=HTTPStatus.OK)[source]

Bases: Response

class bexchange.web.util.NoContentResponse[source]

Bases: Response

class bexchange.web.util.PermanentRedirectResponse(newlocation)[source]

Bases: Response

class bexchange.web.util.Request(environ, max_content_length=None, max_form_memory_size=None)[source]

Bases: Request, JsonRequestMixin

class bexchange.web.util.RequestContext(request, backend, provider)[source]

Bases: object

is_anonymous()[source]
make_url(path)[source]
class bexchange.web.util.Response(response, content_type='text/plain', status=HTTPStatus.OK)[source]

Bases: Response

class bexchange.web.util.TemporaryRedirectResponse(newlocation)[source]

Bases: Response

Module contents