univention.admin.rest.client package

univention.admin.rest.client package

Sample Client for the UDM REST API.

>>> from univention.admin.rest.client import UDM
>>> uri = 'http://localhost/univention/udm/'
>>> udm = UDM.http(uri, 'Administrator', 'univention')
>>> module = udm.get('users/user')
>>> print('Found {}'.format(module))
>>> obj = next(module.search())
>>> if obj:
>>>     obj = obj.open()
>>> print('Object {}'.format(obj))
exception univention.admin.rest.client.HTTPError(code, message, response)[source]

Bases: Exception

exception univention.admin.rest.client.BadRequest(code, message, response)[source]

Bases: univention.admin.rest.client.HTTPError

exception univention.admin.rest.client.Unauthorized(code, message, response)[source]

Bases: univention.admin.rest.client.HTTPError

exception univention.admin.rest.client.Forbidden(code, message, response)[source]

Bases: univention.admin.rest.client.HTTPError

exception univention.admin.rest.client.NotFound(code, message, response)[source]

Bases: univention.admin.rest.client.HTTPError

exception univention.admin.rest.client.PreconditionFailed(code, message, response)[source]

Bases: univention.admin.rest.client.HTTPError

exception univention.admin.rest.client.UnprocessableEntity(code, message, response)[source]

Bases: univention.admin.rest.client.HTTPError

exception univention.admin.rest.client.ServerError(code, message, response)[source]

Bases: univention.admin.rest.client.HTTPError

exception univention.admin.rest.client.ServiceUnavailable(code, message, response)[source]

Bases: univention.admin.rest.client.HTTPError

exception univention.admin.rest.client.ConnectionError[source]

Bases: Exception

exception univention.admin.rest.client.UnexpectedResponse[source]

Bases: univention.admin.rest.client.ConnectionError

class univention.admin.rest.client.Response(response, data, uri)[source]

Bases: object

class univention.admin.rest.client.Session(credentials, language='en-US', reconnect=True, user_agent='univention.lib/1.0', enable_caching=False)[source]

Bases: object

create_session()[source]
get_method(method)[source]
request(method, uri, data=None, expect_json=False, **headers)[source]
make_request(method, uri, data=None, expect_json=False, allow_redirects=True, **headers)[source]
eval_response(response, expect_json=False)[source]
get_relations(entry, relation, name=None, template=None)[source]
get_relation(entry, relation, name=None, template=None)[source]
resolve_relations(entry, relation, name=None, template=None)[source]
resolve_relation(entry, relation, name=None, template=None)[source]
class univention.admin.rest.client.Client(client)[source]

Bases: object

class univention.admin.rest.client.UDM(uri, username, password, *args, **kwargs)[source]

Bases: univention.admin.rest.client.Client

classmethod http(uri, username, password)[source]
load()[source]
reload()[source]
get_ldap_base()[source]
modules(name=None)[source]
version(api_version)[source]
obj_by_dn(dn)[source]
obj_by_uuid(uuid)[source]
get(name)[source]
get_object(object_type, dn)[source]
class univention.admin.rest.client.Module(udm, uri, name, title, *args, **kwargs)[source]

Bases: univention.admin.rest.client.Client

load_relations()[source]
new(position=None, superordinate=None, template=None)[source]
get(dn)[source]
get_by_entry_uuid(uuid)[source]
get_by_id(dn)[source]
search(filter=None, position=None, scope='sub', hidden=False, superordinate=None, opened=False)[source]
get_layout()[source]
get_properties()[source]
get_property_choices(property)[source]
policy_result(policy_module, position, policy=None)[source]
get_report_types()[source]
create_report(report_type, object_dns)[source]
class univention.admin.rest.client.ShallowObject(udm, dn, uri, *args, **kwargs)[source]

Bases: univention.admin.rest.client.Client

open()[source]
class univention.admin.rest.client.References(obj=None)[source]

Bases: object

class univention.admin.rest.client.Object(udm, representation, etag=None, last_modified=None, *args, **kwargs)[source]

Bases: univention.admin.rest.client.Client

objects
property module
property object_type
property dn
property properties
property options
property policies
property superordinate
property position
property uri
classmethod from_response(udm, response)[source]
classmethod from_data(udm, entry, headers=None)[source]
reload()[source]
save(reload=True)[source]
delete(remove_referring=False)[source]
move(position)[source]
generate_service_specific_password(service)[source]
get_layout()[source]
get_properties()[source]
get_property_choices(property)[source]
policy_result(policy_module, policy=None)[source]