Account Class
Documentation of the Account class.
- class qmenta.client.Account(username=None, password=None, base_url='https://platform.qmenta.com', verify_certificates=True, api_key=None)
It represents your QMENTA account and implements the HTTP connection with the server. Once it is instantiated it will act as an identifier used by the rest of objects.
- Parameters:
username (str, optional) – Username on the platform. To get one go to https://platform.qmenta.com
password (username +) – The password assigned to the username.
base_url (str) – The base url of the platform.
verify_certificates (bool) – verify SSL certificates?
api_key (username + password +) – The API-KEY associated to the user.
combinations (Valid credential) –
----------------------------- –
password – Classic login. If two-factor authentication (2FA) is enabled on the account, the user is prompted for the code interactively.
api_key – API-key login. 2FA is not required.
api_key – All three values are forwarded to the authentication layer, which decides which credential to use.
- auth
The Auth object used for communication with the platform
- Type:
qmenta.core.platform.Auth
- add_project(project_abbreviation, project_name, description='', users=None, from_date='', to_date='')
Add a new project to the user account.
- Parameters:
project_abbreviation (str) – Abbreviation of the project name.
project_name (str) – Project name.
description (str) – Description of the project.
users (list[str]) – List of users to which this project is available.
from_date (str) – Date of beginning of the project.
to_date (str) – Date of ending of the project.
- Returns:
True if project was correctly added, False otherwise
- Return type:
bool
- get_project(project_id)
Retrieve a project instance, given its id, which can be obtained checking account.projects.
- Parameters:
project_id (int or str) – ID of the project to retrieve, either the numeric ID or the name
- Returns:
A project object representing the desired project
- Return type:
- login()
Login to the platform.
Uses the credentials set on the instance (
username/passwordand/orapi_key). Valid combinations:username+password: classic login. If 2FA is enabled on the account, the user is prompted for the code interactively.api_key: API-key login. 2FA is not required.username+password+api_key: all values are forwarded to the authentication layer, which decides which credential to use.
- Raises:
qmenta.core.auth.InvalidLoginError – When the provided credentials are invalid.
qmenta.core.platform.ConnectionError – When the connection to the platform fails.
qmenta.core.errors.PlatformError – When the platform returns an unexpected error.
- logout()
Logout from the platform.
- Raises:
qmenta.core.errors.PlatformError – When the logout was not successful
- property projects
List all the projects available to the current user.
- Returns:
List of project information (name, and id)
- Return type:
list[dict]