arkindex-client 1.0.11__tar.gz → 1.0.12__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.
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/PKG-INFO +1 -1
- arkindex-client-1.0.12/VERSION +1 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex/client.py +34 -4
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex_client.egg-info/PKG-INFO +1 -1
- arkindex-client-1.0.11/VERSION +0 -1
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/MANIFEST.in +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/README.rst +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex/__init__.py +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex/auth.py +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex/exceptions.py +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex/mock.py +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex/pagination.py +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex/transports.py +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex_client.egg-info/SOURCES.txt +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex_client.egg-info/dependency_links.txt +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex_client.egg-info/requires.txt +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex_client.egg-info/top_level.txt +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/requirements.txt +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/setup.cfg +0 -0
- {arkindex-client-1.0.11 → arkindex-client-1.0.12}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.12
|
|
@@ -32,9 +32,18 @@ def options_from_env():
|
|
|
32
32
|
Get API client keyword arguments from environment variables.
|
|
33
33
|
"""
|
|
34
34
|
options = {}
|
|
35
|
-
|
|
35
|
+
# ARKINDEX_TASK_TOKEN takes priority over ARKINDEX_API_TOKEN
|
|
36
|
+
if "ARKINDEX_TASK_TOKEN" in os.environ:
|
|
37
|
+
options["auth_scheme"] = "Ponos"
|
|
38
|
+
options["token"] = os.environ.get("ARKINDEX_TASK_TOKEN")
|
|
39
|
+
elif "ARKINDEX_API_TOKEN" in os.environ:
|
|
40
|
+
options["auth_scheme"] = "Token"
|
|
36
41
|
options["token"] = os.environ.get("ARKINDEX_API_TOKEN")
|
|
37
42
|
|
|
43
|
+
# Allow overriding the default auth schemes
|
|
44
|
+
if "ARKINDEX_API_AUTH_SCHEME" in os.environ:
|
|
45
|
+
options["auth_scheme"] = os.environ.get("ARKINDEX_API_AUTH_SCHEME")
|
|
46
|
+
|
|
38
47
|
if "ARKINDEX_API_URL" in os.environ:
|
|
39
48
|
options["base_url"] = os.environ.get("ARKINDEX_API_URL")
|
|
40
49
|
|
|
@@ -63,6 +72,7 @@ class ArkindexClient(apistar.Client):
|
|
|
63
72
|
def __init__(
|
|
64
73
|
self,
|
|
65
74
|
token=None,
|
|
75
|
+
auth_scheme="Token",
|
|
66
76
|
base_url=DEFAULT_BASE_URL,
|
|
67
77
|
schema_url=None,
|
|
68
78
|
csrf_cookie=None,
|
|
@@ -139,7 +149,11 @@ class ArkindexClient(apistar.Client):
|
|
|
139
149
|
csrf_cookie = csrf_cookies.get(split_base_url.netloc) or "arkindex.csrf"
|
|
140
150
|
|
|
141
151
|
self.configure(
|
|
142
|
-
token=token,
|
|
152
|
+
token=token,
|
|
153
|
+
auth_scheme=auth_scheme,
|
|
154
|
+
base_url=base_url,
|
|
155
|
+
csrf_cookie=csrf_cookie,
|
|
156
|
+
sleep=sleep,
|
|
143
157
|
)
|
|
144
158
|
|
|
145
159
|
def __repr__(self):
|
|
@@ -151,12 +165,25 @@ class ArkindexClient(apistar.Client):
|
|
|
151
165
|
def init_transport(self, *args, **kwargs):
|
|
152
166
|
return ArkindexHTTPTransport(*args, **kwargs)
|
|
153
167
|
|
|
154
|
-
def configure(
|
|
168
|
+
def configure(
|
|
169
|
+
self,
|
|
170
|
+
token=None,
|
|
171
|
+
auth_scheme="Token",
|
|
172
|
+
base_url=None,
|
|
173
|
+
csrf_cookie=None,
|
|
174
|
+
sleep=None,
|
|
175
|
+
):
|
|
155
176
|
"""
|
|
156
177
|
Reconfigure the API client.
|
|
157
178
|
|
|
158
179
|
:param token: An API token to use. If omitted, access is restricted to public endpoints.
|
|
159
180
|
:type token: str or None
|
|
181
|
+
:param auth_scheme:
|
|
182
|
+
An authentication scheme to use. This is added in the HTTP header before the token:
|
|
183
|
+
``Authorization: [scheme] [token]``.
|
|
184
|
+
This should use ``Token`` to authenticate as a regular user and ``Ponos`` to authenticate as a Ponos task.
|
|
185
|
+
If omitted, this defaults to ``Token``.
|
|
186
|
+
:type auth_scheme: str or None
|
|
160
187
|
:param base_url: A custom base URL for the client. If omitted, defaults to the Arkindex main server.
|
|
161
188
|
:type base_url: str or None
|
|
162
189
|
:param csrf_cookie: Use a custom CSRF cookie name. Falls back to ``arkindex.csrf``.
|
|
@@ -167,7 +194,9 @@ class ArkindexClient(apistar.Client):
|
|
|
167
194
|
if not csrf_cookie:
|
|
168
195
|
csrf_cookie = "arkindex.csrf"
|
|
169
196
|
self.transport.session.auth = TokenSessionAuthentication(
|
|
170
|
-
token,
|
|
197
|
+
token,
|
|
198
|
+
csrf_cookie_name=csrf_cookie,
|
|
199
|
+
scheme=auth_scheme,
|
|
171
200
|
)
|
|
172
201
|
|
|
173
202
|
if not sleep or not isinstance(sleep, float) or sleep < 0:
|
|
@@ -200,6 +229,7 @@ class ArkindexClient(apistar.Client):
|
|
|
200
229
|
"""
|
|
201
230
|
resp = self.request("Login", body={"email": email, "password": password})
|
|
202
231
|
if "auth_token" in resp:
|
|
232
|
+
self.transport.session.auth.scheme = "Token"
|
|
203
233
|
self.transport.session.auth.token = resp["auth_token"]
|
|
204
234
|
return resp
|
|
205
235
|
|
arkindex-client-1.0.11/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.0.11
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arkindex-client-1.0.11 → arkindex-client-1.0.12}/arkindex_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|