anaplan-sdk 0.4.4a4__py3-none-any.whl → 0.4.5__py3-none-any.whl

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.
@@ -451,6 +451,17 @@ class AsyncClient(_AsyncBaseClient):
451
451
  ).get("task")
452
452
  )
453
453
 
454
+ async def get_optimizer_log(self, action_id: int, task_id: str) -> bytes:
455
+ """
456
+ Retrieves the solution logs of the specified optimization action task.
457
+ :param action_id: The identifier of the optimization action that was invoked.
458
+ :param task_id: The Task identifier, sometimes also referred to as the Correlation Id.
459
+ :return: The content of the solution logs.
460
+ """
461
+ return await self._get_binary(
462
+ f"{self._url}/optimizeActions/{action_id}/tasks/{task_id}/solutionLogs"
463
+ )
464
+
454
465
  async def invoke_action(self, action_id: int) -> str:
455
466
  """
456
467
  You may want to consider using `run_action()` instead.
anaplan_sdk/_auth.py CHANGED
@@ -4,7 +4,6 @@ from base64 import b64encode
4
4
  from typing import Callable
5
5
 
6
6
  import httpx
7
- import keyring
8
7
 
9
8
  from ._oauth import _OAuthRequestFactory
10
9
  from .exceptions import AnaplanException, InvalidCredentialsException, InvalidPrivateKeyException
@@ -205,7 +204,7 @@ class AnaplanLocalOAuth(_AnaplanAuth):
205
204
  if stored:
206
205
  logger.info("Using persisted OAuth refresh token.")
207
206
  self._oauth_token = {"refresh_token": stored}
208
- self._token = None # Set to None to trigger the super().__init__ auth request.
207
+ self._token = "" # Set to blank to trigger the super().__init__ auth request.
209
208
  except ImportError as e:
210
209
  raise AnaplanException(
211
210
  "keyring is not available. Please install anaplan-sdk with the keyring extra "
@@ -246,6 +245,8 @@ class AnaplanLocalOAuth(_AnaplanAuth):
246
245
  raise AnaplanException(f"Authentication failed: {response.status_code} {response.text}")
247
246
  self._oauth_token = response.json()
248
247
  if self._persist_token:
248
+ import keyring
249
+
249
250
  keyring.set_password(
250
251
  self._service_name, self._service_name, self._oauth_token["refresh_token"]
251
252
  )
@@ -304,7 +305,7 @@ class AnaplanRefreshTokenAuth(_AnaplanAuth):
304
305
  :param token_url: The URL to post the refresh token request to in order to fetch the access
305
306
  token.
306
307
  """
307
- if not isinstance(token, dict) and all(
308
+ if not isinstance(token, dict) or not all(
308
309
  key in token for key in ("access_token", "refresh_token")
309
310
  ):
310
311
  raise ValueError(
@@ -322,7 +323,7 @@ class AnaplanRefreshTokenAuth(_AnaplanAuth):
322
323
  @property
323
324
  def token(self) -> dict[str, str]:
324
325
  """
325
- Returns the current token dictionary. You can safely use the `access_token`, but if you
326
+ Returns the current OAuth token. You can safely use the `access_token`, but you
326
327
  must not use the `refresh_token` outside of this class, if you expect to use this instance
327
328
  further. If you do use the `refresh_token` outside of this class, this will error on the
328
329
  next attempt to refresh the token, as the `refresh_token` can only be used once.
@@ -438,6 +438,17 @@ class Client(_BaseClient):
438
438
  )
439
439
  )
440
440
 
441
+ def get_optimizer_log(self, action_id: int, task_id: str) -> bytes:
442
+ """
443
+ Retrieves the solution logs of the specified optimization action task.
444
+ :param action_id: The identifier of the optimization action that was invoked.
445
+ :param task_id: The Task identifier, sometimes also referred to as the Correlation Id.
446
+ :return: The content of the solution logs.
447
+ """
448
+ return self._get_binary(
449
+ f"{self._url}/optimizeActions/{action_id}/tasks/{task_id}/solutionLogs"
450
+ )
451
+
441
452
  def invoke_action(self, action_id: int) -> str:
442
453
  """
443
454
  You may want to consider using `run_action()` instead.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anaplan-sdk
3
- Version: 0.4.4a4
3
+ Version: 0.4.5
4
4
  Summary: Streamlined Python Interface for Anaplan
5
5
  Project-URL: Homepage, https://vinzenzklass.github.io/anaplan-sdk/
6
6
  Project-URL: Repository, https://github.com/VinzenzKlass/anaplan-sdk
@@ -60,7 +60,8 @@ abstractions over all Anaplan APIs, allowing you to focus on business requiremen
60
60
 
61
61
  ## Getting Started
62
62
 
63
- Head over to the [Quick Start](quickstart.md) for basic usage instructions and examples.
63
+ Head over to the [Quick Start](https://vinzenzklass.github.io/anaplan-sdk/quickstart/) for basic usage instructions and
64
+ examples.
64
65
 
65
66
  ## Contributing
66
67
 
@@ -1,19 +1,19 @@
1
1
  anaplan_sdk/__init__.py,sha256=WScEKtXlnRLjCb-j3qW9W4kEACTyPsTLFs-L54et2TQ,351
2
- anaplan_sdk/_auth.py,sha256=H5A_fujTMHf7J33w2jkqMYtlxKFwzqZgxFcBJHi8wvc,16612
2
+ anaplan_sdk/_auth.py,sha256=l5z2WCcfQ05OkuQ1dcmikp6dB87Rw1qy2zu8bbaAQTs,16620
3
3
  anaplan_sdk/_base.py,sha256=9CdLshORWsLixOyoFa3A0Bka5lhLwlZrQI5sEdBcGFI,12298
4
4
  anaplan_sdk/_oauth.py,sha256=AynlJDrGIinQT0jwxI2RSvtU4D7Wasyw3H1uicdlLVI,12672
5
5
  anaplan_sdk/exceptions.py,sha256=ALkA9fBF0NQ7dufFxV6AivjmHyuJk9DOQ9jtJV2n7f0,1809
6
6
  anaplan_sdk/_async_clients/__init__.py,sha256=pZXgMMg4S9Aj_pxQCaSiPuNG-sePVGBtNJ0133VjqW4,364
7
7
  anaplan_sdk/_async_clients/_alm.py,sha256=O1_r-O1tNDq7vXRwE2UEFE5S2bPmPh4IAQPQ8bmZfQE,3297
8
8
  anaplan_sdk/_async_clients/_audit.py,sha256=a92RY0B3bWxp2CCAWjzqKfvBjG1LJGlai0Hn5qmwgF8,2312
9
- anaplan_sdk/_async_clients/_bulk.py,sha256=j0yMoM8NWQH9BsSQ4LRYt8djfd1d11vkjNfU8pUeGLU,23737
9
+ anaplan_sdk/_async_clients/_bulk.py,sha256=Bpq5HT8tT48YznN7gfycGb4LNR5WW5QBVXgo_kZsEj0,24295
10
10
  anaplan_sdk/_async_clients/_cloud_works.py,sha256=KPX9W55SF6h8fJd4Rx-HLq6eaRA-Vo3rFu343UiiaGQ,16642
11
11
  anaplan_sdk/_async_clients/_cw_flow.py,sha256=ZTNAbKDwb59Wg3u68hbtt1kpd-LNz9K0sftT-gvYzJQ,3651
12
12
  anaplan_sdk/_async_clients/_transactional.py,sha256=Mvr7OyBPjQRpBtzkJNfRzV4aNCzUiaYmm0zQubo62Wo,8035
13
13
  anaplan_sdk/_clients/__init__.py,sha256=FsbwvZC1FHrxuRXwbPxUzbhz_lO1DpXIxEOjx6-3QuA,219
14
14
  anaplan_sdk/_clients/_alm.py,sha256=UAdQxgHfax-VquC0YtbqrRBku2Rn35tVgwJdxYFScps,3202
15
15
  anaplan_sdk/_clients/_audit.py,sha256=xQQiwWIb4QQefolPvxNwBFE-pkRzzi8fYPyewjF63lc,2181
16
- anaplan_sdk/_clients/_bulk.py,sha256=nlsZHK8vjhvyC0auRuqyvJVvTISPqj9EIHBYLoqSpOc,23354
16
+ anaplan_sdk/_clients/_bulk.py,sha256=_-kb50yL-I-AjLtvhdvLpNyMVb4luRlfBEtxT_q3jO0,23900
17
17
  anaplan_sdk/_clients/_cloud_works.py,sha256=KAMnLoeMJ2iwMXlDSbKynCE57BtkCfOgM5O8wT1kkSs,16291
18
18
  anaplan_sdk/_clients/_cw_flow.py,sha256=5IFWFT-qbyGvaSOOtaFOjHnOlyYbj4Rj3xiavfTlm8c,3527
19
19
  anaplan_sdk/_clients/_transactional.py,sha256=YUVbA54uhMloQcahwMtmZO3YooO6qQzwZN3ZRSu_z_c,7976
@@ -24,7 +24,7 @@ anaplan_sdk/models/_bulk.py,sha256=_lHARGGjJgi-AmA7u5ZfCmGpLecPnr73LSAsZSX-a_A,8
24
24
  anaplan_sdk/models/_transactional.py,sha256=_0UbVR9D5QABI29yloYrJTSgL-K0EU7PzPeJu5LdhnY,4854
25
25
  anaplan_sdk/models/cloud_works.py,sha256=nfn_LHPR-KmW7Tpvz-5qNCzmR8SYgvsVV-lx5iDlyqI,19425
26
26
  anaplan_sdk/models/flows.py,sha256=SuLgNj5-2SeE3U1i8iY8cq2IkjuUgd_3M1n2ENructk,3625
27
- anaplan_sdk-0.4.4a4.dist-info/METADATA,sha256=uf0KLkAvBJr3cY668F9T-wuIG5uya2zHvIRu-roipVo,3628
28
- anaplan_sdk-0.4.4a4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
- anaplan_sdk-0.4.4a4.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
30
- anaplan_sdk-0.4.4a4.dist-info/RECORD,,
27
+ anaplan_sdk-0.4.5.dist-info/METADATA,sha256=drUkXHMRjawxKTPMzL2bPTxCWx2XCwQCD9hrm1LNriw,3667
28
+ anaplan_sdk-0.4.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
+ anaplan_sdk-0.4.5.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
30
+ anaplan_sdk-0.4.5.dist-info/RECORD,,