iland package

Submodules

iland.api module

A library that provides a Python interface to the iland cloud API.

class iland.api.Api(client_id, client_secret, username, password)[source]

Bases: object

A Python interface into the iland cloud API

delete(rpath, headers=None)[source]

Perform a DELETE request against the iland cloud API given its resource path.

iland.Api will refresh the access token if non valid.

Parameters:
  • rpath – the resource path as a Python builtin String object
  • headers – an optional dictionary of http headers to send with the request
Raises:

ApiException: API requests returns an error

Raises:

UnauthorizedException: credentials / grants invalids

Returns:

a JSON Object or a list of JSON Objects.

get(rpath, headers=None)[source]

Perform a GET request against the iland cloud API given its resource path.

iland.Api will refresh the access token if non valid.

Parameters:
  • rpath – the resource path as a Python builtin String object
  • headers – an optional dictionary of http headers to send with the request
Raises:

ApiException: API requests returns an error

Raises:

UnauthorizedException: credentials / grants invalids

Returns:

a JSON Object or a list of JSON Objects.

get_access_token()[source]

Returns the access token in use for this session.

This method is exposed in case you are interested in managing the token life cycle yourself. iland.Api will refresh the token on your behalf while performing queries.

Raises:UnauthorizedException: credentials / grants invalids
Returns:JSON Object containing the actual access token
login()[source]

Requests an access token.

This method is exposed in case you are interested in managing the token life cycle yourself. iland.Api will refresh the token on your behalf while performing queries.

Raises:UnauthorizedException: credentials / grants invalids
Returns:JSON Object containing the actual access token
post(rpath, form_data=None, headers=None)[source]

Perform a POST request against the iland cloud API given its resource path.

iland.Api will refresh the access token if non valid.

Parameters:
  • rpath – the resource path as a Python builtin String object
  • form_data – a Python builtin dict object
  • headers – an optional dictionary of http headers to send with the request
Raises:

ApiException: API requests returns an error

Raises:

UnauthorizedException: credentials / grants invalids

Returns:

a JSON Object or a list of JSON Objects.

put(rpath, form_data=None, headers=None)[source]

Perform a PUT request against the iland cloud API given its resource path.

iland.Api will refresh the access token if non valid.

Parameters:
  • rpath – the resource path as a Python builtin String object
  • form_data – a Python builtin dict object
  • headers – an optional dictionary of http headers to send with the request
Raises:

ApiException: API requests returns an error

Raises:

UnauthorizedException: credentials / grants invalids

Returns:

a JSON Object or a list of JSON Objects.

refresh_access_token()[source]

Refresh token if token is not valid: None or expired.

This method is exposed in case you are interested in managing the token life cycle yourself. iland.Api will refresh the token on your behalf while performing queries.

Raises:UnauthorizedException: credentials / grants invalids
Returns:JSON Object containing the actual access token

iland.constant module

A library that provides constants for the iland.Api object.

iland.constant.ACCESS_URL = 'https://console.ilandcloud.com/auth/realms/iland-core/protocol/openid-connect/token'

Access token URL.

iland.constant.BASE_URL = 'https://api.ilandcloud.com/v1'

Base URL to the iland cloud API.

iland.exception module

A library that provides custom exceptions for the iland.Api module.

exception iland.exception.ApiException[source]

Bases: exceptions.Exception

Base class for iland.Api errors.

detail_message

Returns the third argument used to construct this error.

error

Returns the first argument used to construct this error.

message

Returns the second argument used to construct this error.

exception iland.exception.UnauthorizedException[source]

Bases: iland.exception.ApiException

Unauthorized iland.Api exception.

iland.log module

A library that provides a custom logger for the iland.Api object.

iland.log.LOG = <logging.Logger object>

A custom Python logging logger for the iland.Api object.

Module contents

A module that provides a Python interface to the iland cloud API.