qmenta-client 2.2.0.dev1522__tar.gz → 3.0.0.dev1524__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qmenta_client-2.2.0.dev1522 → qmenta_client-3.0.0.dev1524}/PKG-INFO +2 -2
- {qmenta_client-2.2.0.dev1522 → qmenta_client-3.0.0.dev1524}/pyproject.toml +2 -4
- {qmenta_client-2.2.0.dev1522 → qmenta_client-3.0.0.dev1524}/src/qmenta/client/Account.py +40 -8
- {qmenta_client-2.2.0.dev1522 → qmenta_client-3.0.0.dev1524}/src/qmenta/__init__.py +0 -0
- {qmenta_client-2.2.0.dev1522 → qmenta_client-3.0.0.dev1524}/src/qmenta/client/File.py +0 -0
- {qmenta_client-2.2.0.dev1522 → qmenta_client-3.0.0.dev1524}/src/qmenta/client/Project.py +0 -0
- {qmenta_client-2.2.0.dev1522 → qmenta_client-3.0.0.dev1524}/src/qmenta/client/Subject.py +0 -0
- {qmenta_client-2.2.0.dev1522 → qmenta_client-3.0.0.dev1524}/src/qmenta/client/__init__.py +0 -0
- {qmenta_client-2.2.0.dev1522 → qmenta_client-3.0.0.dev1524}/src/qmenta/client/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: qmenta-client
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0.dev1524
|
|
4
4
|
Summary: Python client lib to interact with the QMENTA platform.
|
|
5
5
|
Author: QMENTA
|
|
6
6
|
Author-email: dev@qmenta.com
|
|
@@ -14,5 +14,5 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Requires-Dist: future (>=0.18.2,<0.19.0)
|
|
16
16
|
Requires-Dist: pytest-cov (>=6.1.1,<7.0.0)
|
|
17
|
-
Requires-Dist: qmenta-core (==
|
|
17
|
+
Requires-Dist: qmenta-core (==5.0.0.dev723)
|
|
18
18
|
Project-URL: Homepage, https://www.qmenta.com/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "qmenta-client"
|
|
3
|
-
version = "
|
|
3
|
+
version = "3.0.0.dev1524"
|
|
4
4
|
description = "Python client lib to interact with the QMENTA platform."
|
|
5
5
|
authors = ["QMENTA <dev@qmenta.com>"]
|
|
6
6
|
homepage = "https://www.qmenta.com/"
|
|
@@ -15,7 +15,7 @@ packages = [
|
|
|
15
15
|
[tool.poetry.dependencies]
|
|
16
16
|
python = "^3.10"
|
|
17
17
|
future = "^0.18.2"
|
|
18
|
-
qmenta-core = "
|
|
18
|
+
qmenta-core = "5.0.0.dev723"
|
|
19
19
|
pytest-cov = "^6.1.1"
|
|
20
20
|
|
|
21
21
|
[tool.poetry.group.dev.dependencies]
|
|
@@ -27,8 +27,6 @@ scriv = {version = "^0.15.2", extras = ["toml"]}
|
|
|
27
27
|
coverage = "^7.2.5"
|
|
28
28
|
flake8 = "^7.1.2"
|
|
29
29
|
responses = "^0.25.7"
|
|
30
|
-
cyclonedx-bom = "^7.0.0"
|
|
31
|
-
|
|
32
30
|
|
|
33
31
|
[build-system]
|
|
34
32
|
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
@@ -3,6 +3,7 @@ from __future__ import print_function
|
|
|
3
3
|
import logging
|
|
4
4
|
from qmenta.core import errors
|
|
5
5
|
from qmenta.core import platform
|
|
6
|
+
from qmenta.core.auth import InvalidLoginError
|
|
6
7
|
from urllib3.exceptions import HTTPError
|
|
7
8
|
|
|
8
9
|
from .Project import Project
|
|
@@ -19,14 +20,27 @@ class Account:
|
|
|
19
20
|
|
|
20
21
|
Parameters
|
|
21
22
|
----------
|
|
22
|
-
username : str
|
|
23
|
+
username : str, optional
|
|
23
24
|
Username on the platform. To get one go to https://platform.qmenta.com
|
|
24
|
-
password : str
|
|
25
|
+
password : str, optional
|
|
25
26
|
The password assigned to the username.
|
|
26
27
|
base_url : str
|
|
27
28
|
The base url of the platform.
|
|
28
29
|
verify_certificates : bool
|
|
29
30
|
verify SSL certificates?
|
|
31
|
+
api_key : str, optional
|
|
32
|
+
The API-KEY associated to the user.
|
|
33
|
+
|
|
34
|
+
Valid credential combinations
|
|
35
|
+
-----------------------------
|
|
36
|
+
username + password
|
|
37
|
+
Classic login. If two-factor authentication (2FA) is enabled on the
|
|
38
|
+
account, the user is prompted for the code interactively.
|
|
39
|
+
api_key
|
|
40
|
+
API-key login. 2FA is not required.
|
|
41
|
+
username + password + api_key
|
|
42
|
+
All three values are forwarded to the authentication layer, which
|
|
43
|
+
decides which credential to use.
|
|
30
44
|
|
|
31
45
|
Attributes
|
|
32
46
|
----------
|
|
@@ -36,15 +50,17 @@ class Account:
|
|
|
36
50
|
|
|
37
51
|
def __init__(
|
|
38
52
|
self,
|
|
39
|
-
username,
|
|
40
|
-
password,
|
|
53
|
+
username=None,
|
|
54
|
+
password=None,
|
|
41
55
|
base_url="https://platform.qmenta.com",
|
|
42
56
|
verify_certificates=True,
|
|
57
|
+
api_key=None,
|
|
43
58
|
):
|
|
44
59
|
|
|
45
60
|
self._cookie = None
|
|
46
61
|
self.username = username
|
|
47
62
|
self.password = password
|
|
63
|
+
self.api_key = api_key
|
|
48
64
|
self.baseurl = base_url
|
|
49
65
|
self.verify_certificates = verify_certificates
|
|
50
66
|
self.auth = None
|
|
@@ -58,21 +74,37 @@ class Account:
|
|
|
58
74
|
"""
|
|
59
75
|
Login to the platform.
|
|
60
76
|
|
|
77
|
+
Uses the credentials set on the instance (``username``/``password``
|
|
78
|
+
and/or ``api_key``). Valid combinations:
|
|
79
|
+
|
|
80
|
+
- ``username`` + ``password``: classic login. If 2FA is enabled on
|
|
81
|
+
the account, the user is prompted for the code interactively.
|
|
82
|
+
- ``api_key``: API-key login. 2FA is not required.
|
|
83
|
+
- ``username`` + ``password`` + ``api_key``: all values are forwarded
|
|
84
|
+
to the authentication layer, which decides which credential to use.
|
|
85
|
+
|
|
61
86
|
Raises
|
|
62
87
|
------
|
|
88
|
+
qmenta.core.auth.InvalidLoginError
|
|
89
|
+
When the provided credentials are invalid.
|
|
63
90
|
qmenta.core.platform.ConnectionError
|
|
64
91
|
When the connection to the platform fails.
|
|
65
|
-
qmenta.core.
|
|
66
|
-
When
|
|
92
|
+
qmenta.core.errors.PlatformError
|
|
93
|
+
When the platform returns an unexpected error.
|
|
67
94
|
"""
|
|
68
95
|
logger = logging.getLogger(logger_name)
|
|
69
96
|
try:
|
|
70
97
|
auth = platform.Auth.login(
|
|
71
|
-
self.username,
|
|
72
|
-
self.password,
|
|
98
|
+
username=self.username,
|
|
99
|
+
password=self.password,
|
|
100
|
+
api_key=self.api_key,
|
|
73
101
|
base_url=self.baseurl,
|
|
74
102
|
ask_for_2fa_input=True,
|
|
75
103
|
)
|
|
104
|
+
except InvalidLoginError as e:
|
|
105
|
+
logger.error("Failed to log in: {}".format(e))
|
|
106
|
+
self.auth = None
|
|
107
|
+
raise
|
|
76
108
|
except errors.PlatformError as e:
|
|
77
109
|
logger.error("Failed to log in: {}".format(e))
|
|
78
110
|
self.auth = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|