Lagoon()

class Lagoon(api_url='', token=None, api_version='v1', domain=None, strict_dotmap=False)

This class describes the main class of Lagoon

Parameters:
  • api_url (string) – Specify the URL of the API.

  • token (string, optional) – Specify the authentication token, to avoid signin()

  • api_version (string, optional) – Specify the API version you want to use (default : v1).

  • domain (string, optional) – Specify the domain used for unauthenticated requests. Mainly for Lagoon Fatfish Lab dev or local Lagoon server without DNS

  • strict_dotmap (boolean, optional) – Specify if the dotmap should create new property dynamically (default : False). Set to True to have default Python behaviour like on Dict()

Variables:
  • token – Get the current token (populated after a first signin())

  • edge (Edge) – Access to Edge class

  • project (Project) – Access to Project subclass

  • bot (Bot) – Access to Bot subclass

  • user (User) – Access to User subclass

  • usergroup (Usergroup) – Access to Usergroup subclass

  • organisation (Organisation) – Access to Organisation subclass

  • utils (Utils) – Access to Utils class

cast(data={})

Creates an item or edge instance from a dictionary

Parameters:

data (dictionary) – The object item or edge from Lagoon API

Returns:

Instance of Edge or Item or items subclass

Return type:

Edge | Item : [Asset | Project | Shot | Task | Template | User | Usergroup]

create_user(email, name=None, lagoon_url=None)

Create a new user

Parameters:
  • email (string) – The email of the new user

  • name (string, optional) – The name of the new user

  • lagoon_url (string, optional (default is api_url used during module initialisation)) – The Lagoon interface url. Useful if API url is not the same as Lagoon interface.

Returns:

User object

Return type:

User

do_request(*args, **kwargs)

Execute a request to the API

Parameters:
  • args (tuple) – Parameters used to send the request : HTTP verb, API endpoint

  • kwargs (dictionary) – Headers, data and parameters used for the request

Returns:

Request response

Return type:

List or dictionary

forgot_password(email, lagoon_url=None)

Start forgot password procedure. User will receive an email to reset its password.

Parameters:
  • email (string) – Email of the user who forgot its password

  • lagoon_url (string, optional (default is api_url used during module initialisation)) – The Lagoon interface url. Useful if API url is not the same as Lagoon interface.

Returns:

True or False

Return type:

boolean

get_file(file_path)

Get stored file on Lagoon server

Parameters:

file_path (string) – The file path from item property (Exemple: /files/file_id.jpg)

Returns:

The file

Return type:

list

get_organisations(limit=200, offset=None)

List all organisations

Parameters:
  • limit (int, optional) – The maximum number of organisations to retrieve (default: 200)

  • offset (int, optional) – The offset to start retrieving organisations from (default: None)

Returns:

List of organisations

Return type:

List of Organisation

get_server_status()

Gets the server status.

Returns:

The server status

Return type:

dictionary

get_users()

Get all users

Returns:

List of all users

Return type:

List of User

me()

Alias of get_current()

Returns:

A User instance of the connected user.

Return type:

User object

mine()

Alias of get_profile()

Returns:

User, Usergroups and Organisations object

Return type:

Dict {user: User, usergroups: [Usergroup], organisations: [Organisation]}

ping()

Ping Lagoon server

Returns:

Ping response: pong

Return type:

string

query(meshql='', aliases={})

Query entities

Tip

For better performances, we advice you to use the function traverse()

Parameters:
  • meshql (string) – The meshql string

  • aliases (dictionary) – The aliases used in the meshql query

Returns:

List of item, edge or VIEW used in the meshql query

Return type:

list

signin(email='', password='')

Sign in a user with its email and password

Parameters:
  • email (string) – The email of the user

  • password (string) – The password of the user

signout()

Sign out current user by clearing the stored authentication token

Note

After a signout(), you need to use a signin() before sending authenticated requests

Returns:

None

upload_file(path='')

Uploads a file on the server

Note

The file is just uploaded to Lagoon. The metadata are not saved on any item. Use update_data() to save them on an item. You can also directly upload a file on an item with upload_file().

Parameters:

path (string) – The path of the file to upload

Returns:

The file metadata on Lagoon

Return type:

dictionary