caosdb.connection.interface module

This module defines the CaosDBServerConnection interface.

class caosdb.connection.interface.CaosDBHTTPResponse

Bases: abc.ABC

An abstract class which defines a minimal interface for responses of the CaosDBServer.

abstract close()

close.

Close this response. Depending on the implementation this might also close underlying streams, sockets etc.

abstract getheader(name, default=None)

Return the value of the header name or the value of default if there is no such header.

If there are multiple headers with that name, return all of the values joined by ‘, ‘. If default is an iterable, its elements are returned likewise.

abstract getheaders()

Return all headers.

abstract read(size=- 1)

Read up to size bytes from the response body.

If size is unspecified or -1, all bytes until EOF are returned.

abstract property status

Status code of the response.

class caosdb.connection.interface.CaosDBServerConnection

Bases: abc.ABC

Abstract class which defines the interface for sending requests to the caosdb server.

abstract configure(**kwargs)

Configure the connection. This method is to be called by configure_connection.

Returns

Return type

None

abstract request(method, path, headers=None, body=None, **kwargs)

Abstract method. Implement this method for HTTP requests to the caosdb server.

Returns

Return type

CaosDBHTTPResponse