Api

Represents an hypermedia API, encapsulates its behaviour and knows how to build requests and how to interpret its responses.

For convenience it also represents the Base resource of the API, therefore an Api object would be a good starting point for browsing CONFINE API.

class Api(uri[, username='', password=''])
Represents a REST API encapsulating some assumptions about its behaviour.
  • application/json is the default content-type
  • Tokens are the default authentication mechanism

However it tries to be a generic implementation, support for other methods and types can be achieved by means of subclassing and method overiding.

login([username=None, password=None])
Authenticates to the Api, further requests will use authentication.
logout()
Deauthenticates from an Api.
classmethod enable_logging()
Enables HTTP requests logging, useful for profiling.
classmethod disable_logging()
Disables HTTP requests logging.

Examples