IbisClientConnection¶

Class in module ibisclient.connection

class IbisClientConnection(host, port, url_base, check_certs)¶

Bases: object

Class to connect to the Lookup/Ibis server and invoke web service API methods.

Code author: Dean Rasheed (dev-group@ucs.cam.ac.uk)

invoke_method(method, path, path_params={}, query_params={}, form_params={})¶

Invoke a web service GET, POST, PUT or DELETE method.

The path should be the relative path to the method with standard Python format specifiers for any path parameters, for example "/api/v1/person/%(scheme)s/%(identifier)s". Any path parameters specified are then substituted into the path.

Parameters
methodstr

[required] The method type ("GET", "POST", "PUT" or "DELETE").

pathstr

[required] The path to the method to invoke.

path_paramsdict

[optional] Any path parameters that should be inserted into the path in place of any format specifiers.

query_paramsdict

[optional] Any query parameters to add as part of the URL’s query string.

form_paramsdict

[optional] Any form parameters to submit.

Returns
IbisResult

The result of invoking the method.

set_password(password)¶

Set the password to use when connecting to the Lookup/Ibis web service. This is only necessary when connecting as a group, in which case it should be that group’s password.

Parameters
passwordstr

[required] The group password.

set_username(username)¶

Set the username to use when connecting to the Lookup/Ibis web service. By default connections are anonymous, which gives read-only access. This method enables authentication as a group, using the group’s password, which gives read/write access and also access to certain non-public data, based on the group’s privileges.

This method may be called at any time, and affects all subsequent access using this connection, but does not affect any other IbisClientConnection objects.

Parameters
usernamestr

[required] The username to connect as. This should either be "anonymous" (the default) or the name of a group.