.. _login-label: Logging In and Activating a QMENTA Project =========================================== Log in ------------------------ .. note:: Prior to using the QMENTA Client API, all users must be registered to the `QMENTA Platform `_. In order to log in, establish a connection with the QMENTA Platform by creating an instance of your account using your username and password: .. code-block:: python import qmenta.client # Create a connection (logs in automatically). account = qmenta.client.Account("user", "password") # This will generate a request for your user, password, and two-factor authentication (if enabled). Once logged in, you can check your available Projects as shown next: .. code-block:: python print(account.projects) Example output: .. parsed-literal:: [{'id': 80, 'name': 'Nunc interdum lacus sit'}, {'id': 43, 'name': 'Test Project'}] See that each element in the list is composed of a Project ID (:code:`id`) and a Project Name (:code:`name`). Project ID is the unique identifier of the Project. .. note:: The QMENTA Platform support various types of Projects and user roles. Having a restricted role may limit the functionalities of this API. See `Roles and Permissions `_ for further details. Activate a Project ------------------ To activate a Project, its Project ID is required. Identify the Project ID as shown above, via the Project Name, or directly from the QMENTA Platform dashboard as shown in the following image. .. figure:: figs/login_project/1.webp In the QMENTA Platform dashboard you can obtain the Project ID by hovering the mouse over the desired Project. Activate a Project using its Project ID as follows: .. code-block:: python # Define Project ID. project_id = "43" # Activate Project project = qmenta.client.Project(account, project_id) Activate a Project indirectly via its Project Name as follows: .. code-block:: python # Retrieve the Project ID using the Project Name: project_name = "Test Project" project = next((qmenta.client.Project(account, p["id"]) for p in account.projects if p["name"] == project_name), None) The variable :code:`project` is an instance of :py:class:`Project`, which allows you to interact with the Project's data and settings. Next Steps ---------- Explore the following sections in detail: - :ref:`data-upload-label` – Upload data. - :ref:`data-search-label` – Perform data and metadata searches. - :ref:`modify-metadata-label` – Modify metadata. - :ref:`launch-analysis-label` – Execute analyses. - :ref:`download-results-label` – Retrieve and store analysis outputs.