automizor 0.4.9__py3-none-any.whl → 0.4.10__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.
automizor/__init__.py CHANGED
@@ -1 +1 @@
1
- version = "0.4.9"
1
+ version = "0.4.10"
@@ -10,27 +10,21 @@ class DataStore:
10
10
  to manage and manipulate data stored in various formats. It supports
11
11
  operations to retrieve and update data using a unified API.
12
12
 
13
- The class initializes an HTTP session with the necessary headers for
13
+ The class initializes an HTTP request with the necessary headers for
14
14
  authentication, and provides methods to retrieve values, and set values in
15
15
  the store.
16
-
17
- Attributes:
18
- url (str): The base URL for the API endpoint.
19
- token (str): The authentication token for API access.
20
- session (requests.Session): The HTTP session used to make API requests.
21
16
  """
22
17
 
23
18
  _instance = None
24
19
 
20
+ def __init__(self, api_token: str | None = None):
21
+ self.url, self.token = get_api_config(api_token)
22
+ self.headers = get_headers(self.token)
23
+
25
24
  @classmethod
26
25
  def configure(cls, api_token: str | None = None):
27
26
  cls._instance = cls(api_token)
28
27
 
29
- def __init__(self, api_token: str | None = None):
30
- self.url, self.token = get_api_config(api_token)
31
- self.session = requests.Session()
32
- self.session.headers.update(get_headers(self.token))
33
-
34
28
  @classmethod
35
29
  def get_instance(cls):
36
30
  if cls._instance is None:
@@ -81,7 +75,9 @@ class DataStore:
81
75
  )
82
76
  url = f"https://{self.url}/api/v1/workflow/datastore/{name}/values/"
83
77
  try:
84
- response = self.session.get(url, timeout=10, params=params)
78
+ response = requests.get(
79
+ url, headers=self.headers, params=params, timeout=10
80
+ )
85
81
  response.raise_for_status()
86
82
  return response.json()
87
83
  except requests.HTTPError as exc:
@@ -94,7 +90,7 @@ class DataStore:
94
90
  def _set_values(self, name: str, values: JSON) -> None:
95
91
  url = f"https://{self.url}/api/v1/workflow/datastore/{name}/values/"
96
92
  try:
97
- response = self.session.post(url, json=values, timeout=10)
93
+ response = requests.post(url, headers=self.headers, json=values, timeout=10)
98
94
  response.raise_for_status()
99
95
  except requests.HTTPError as exc:
100
96
  raise AutomizorError.from_response(
automizor/job/_job.py CHANGED
@@ -48,17 +48,16 @@ class Job:
48
48
 
49
49
  _instance = None
50
50
 
51
- @classmethod
52
- def configure(cls, api_token: str | None = None):
53
- cls._instance = cls(api_token)
54
-
55
51
  def __init__(self, api_token: str | None = None):
56
52
  self._context_file = os.getenv("AUTOMIZOR_CONTEXT_FILE", None)
57
53
  self._job_id = os.getenv("AUTOMIZOR_JOB_ID", None)
58
54
 
59
55
  self.url, self.token = get_api_config(api_token)
60
- self.session = requests.Session()
61
- self.session.headers.update(get_headers(self.token))
56
+ self.headers = get_headers(self.token)
57
+
58
+ @classmethod
59
+ def configure(cls, api_token: str | None = None):
60
+ cls._instance = cls(api_token)
62
61
 
63
62
  @classmethod
64
63
  def get_instance(cls):
@@ -129,7 +128,7 @@ class Job:
129
128
  def _read_job_context(self) -> dict:
130
129
  url = f"https://{self.url}/api/v1/rpa/job/{self._job_id}/"
131
130
  try:
132
- response = self.session.get(url, timeout=10)
131
+ response = requests.get(url, headers=self.headers, timeout=10)
133
132
  response.raise_for_status()
134
133
  return response.json().get("context", {})
135
134
  except requests.HTTPError as exc:
@@ -50,15 +50,14 @@ class Storage:
50
50
 
51
51
  _instance = None
52
52
 
53
+ def __init__(self, api_token: str | None = None):
54
+ self.url, self.token = get_api_config(api_token)
55
+ self.headers = get_headers(self.token)
56
+
53
57
  @classmethod
54
58
  def configure(cls, api_token: str | None = None):
55
59
  cls._instance = cls(api_token)
56
60
 
57
- def __init__(self, api_token: str | None = None):
58
- self.url, self.token = get_api_config(api_token)
59
- self.session = requests.Session()
60
- self.session.headers.update(get_headers(self.token))
61
-
62
61
  @classmethod
63
62
  def get_instance(cls):
64
63
  if cls._instance is None:
@@ -80,7 +79,7 @@ class Storage:
80
79
 
81
80
  try:
82
81
  while url:
83
- response = self.session.get(url, timeout=10)
82
+ response = requests.get(url, headers=self.headers, timeout=10)
84
83
  response.raise_for_status()
85
84
  data = response.json()
86
85
 
@@ -109,7 +108,7 @@ class Storage:
109
108
 
110
109
  url = f"https://{self.url}/api/v1/storage/asset/{name}/"
111
110
  try:
112
- response = self.session.delete(url, timeout=10)
111
+ response = requests.delete(url, headers=self.headers, timeout=10)
113
112
  response.raise_for_status()
114
113
  except requests.HTTPError as exc:
115
114
  raise AutomizorError.from_response(
@@ -231,7 +230,9 @@ class Storage:
231
230
  "name": name,
232
231
  }
233
232
  files = {"file": ("text.txt", content, content_type)}
234
- response = self.session.post(url, files=files, data=data, timeout=10)
233
+ response = requests.post(
234
+ url, headers=self.headers, files=files, data=data, timeout=10
235
+ )
235
236
  response.raise_for_status()
236
237
  except requests.HTTPError as exc:
237
238
  raise AutomizorError.from_response(
@@ -265,7 +266,7 @@ class Storage:
265
266
  def _get_asset_url(self, name: str) -> str:
266
267
  url = f"https://{self.url}/api/v1/storage/asset/{name}/"
267
268
  try:
268
- response = self.session.get(url, timeout=10)
269
+ response = requests.get(url, headers=self.headers, timeout=10)
269
270
  response.raise_for_status()
270
271
 
271
272
  url = response.json().get("file")
@@ -300,7 +301,9 @@ class Storage:
300
301
  "name": name,
301
302
  }
302
303
  files = {"file": ("text.txt", content, content_type)}
303
- response = self.session.put(url, files=files, data=data, timeout=10)
304
+ response = requests.put(
305
+ url, headers=self.headers, files=files, data=data, timeout=10
306
+ )
304
307
  response.raise_for_status()
305
308
  except requests.HTTPError as exc:
306
309
  raise AutomizorError.from_response(
automizor/vault/_vault.py CHANGED
@@ -44,15 +44,14 @@ class Vault:
44
44
 
45
45
  _instance = None
46
46
 
47
+ def __init__(self, api_token: str | None = None):
48
+ self.url, self.token = get_api_config(api_token)
49
+ self.headers = get_headers(self.token)
50
+
47
51
  @classmethod
48
52
  def configure(cls, api_token: str | None = None):
49
53
  cls._instance = cls(api_token)
50
54
 
51
- def __init__(self, api_token: str | None = None):
52
- self.url, self.token = get_api_config(api_token)
53
- self.session = requests.Session()
54
- self.session.headers.update(get_headers(self.token))
55
-
56
55
  @classmethod
57
56
  def get_instance(cls):
58
57
  if cls._instance is None:
@@ -114,7 +113,9 @@ class Vault:
114
113
  def _create_secret(self, secret: SecretContainer) -> SecretContainer:
115
114
  url = f"https://{self.url}/api/v1/vault/secret/"
116
115
  try:
117
- response = self.session.post(url, timeout=10, json=asdict(secret))
116
+ response = requests.post(
117
+ url, headers=self.headers, timeout=10, json=asdict(secret)
118
+ )
118
119
  response.raise_for_status()
119
120
  return SecretContainer(**response.json())
120
121
  except requests.HTTPError as exc:
@@ -127,7 +128,7 @@ class Vault:
127
128
  def _get_secret(self, name: str) -> SecretContainer:
128
129
  url = f"https://{self.url}/api/v1/vault/secret/{name}/"
129
130
  try:
130
- response = self.session.get(url, timeout=10)
131
+ response = requests.get(url, headers=self.headers, timeout=10)
131
132
  response.raise_for_status()
132
133
  return SecretContainer(**response.json())
133
134
  except requests.HTTPError as exc:
@@ -140,7 +141,9 @@ class Vault:
140
141
  def _update_secret(self, secret: SecretContainer) -> SecretContainer:
141
142
  url = f"https://{self.url}/api/v1/vault/secret/{secret.name}/"
142
143
  try:
143
- response = self.session.put(url, timeout=10, json=asdict(secret))
144
+ response = requests.put(
145
+ url, headers=self.headers, timeout=10, json=asdict(secret)
146
+ )
144
147
  response.raise_for_status()
145
148
  return SecretContainer(**response.json())
146
149
  except requests.HTTPError as exc:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: automizor
3
- Version: 0.4.9
3
+ Version: 0.4.10
4
4
  Summary: Python Automizor framework
5
5
  Home-page: https://github.com/automizor/automizor-python
6
6
  Author: Christian Fischer
@@ -1,20 +1,20 @@
1
- automizor/__init__.py,sha256=ElLL68L1maenU2D5V6AoUj5l5Opu9EHBBw3V9qIFxV4,18
1
+ automizor/__init__.py,sha256=XxfULjVU_ewxlK1iP8zCIo68qAo_TYC2AAlK0zPbeS8,19
2
2
  automizor/exceptions.py,sha256=P5imySIOtG3ZIk2kh41Yod4RnlgTj7Vf0P3M-RuxQJs,1382
3
3
  automizor/datastore/__init__.py,sha256=_rAdRfKnTa4SuSLl9GkAYziBPPLsy6yGfS0HprgokOk,2418
4
4
  automizor/datastore/_container.py,sha256=rHRkSWaRgy2rk6Qy-7ADFKvuET_COZ2i9VD7gvRDnlM,745
5
- automizor/datastore/_datastore.py,sha256=EW8AnZPvr32Yz3bC6SxadRgihY7_G-XcwSfLV5CMzMg,3552
5
+ automizor/datastore/_datastore.py,sha256=Xtl64A-q3N9xP2lppPwgLNpqNMTHA5VoCO74T0vi-ZE,3349
6
6
  automizor/job/__init__.py,sha256=pDqSfR4lAyJNCi-fpG6byUPidHz8sntBs0bB2lJFVAY,1118
7
- automizor/job/_job.py,sha256=oVv7utlpaIPVBSnBXcV9jf7B3UNsWCDLtPkw0m3IJio,5444
7
+ automizor/job/_job.py,sha256=TvZYxrl9JNXV5RZolOSdGMIQTNkiIy_MIPlDP2_-euM,5406
8
8
  automizor/log/__init__.py,sha256=gEr2SuwN1FgX1NMnbphjg8_gfSic9L15H3WC868A-TQ,2104
9
9
  automizor/log/_log.py,sha256=P9jAFXVANs5bAGH6-S0pzuSbRKEcX8VlQ_3uu690awE,2948
10
10
  automizor/storage/__init__.py,sha256=RF4ccSAd0UepvJx5NFiotKt9mVr5WiZCb_4qrJ5OKx0,4140
11
- automizor/storage/_storage.py,sha256=ah8sCpRQm0MOnZgOgiBQF1Oamq_mz1VWrV17z6XOuFw,11262
11
+ automizor/storage/_storage.py,sha256=fnYsvcExh6nMZg9YnSrDjbRWDD-szzRFTjcxXh4wIyY,11356
12
12
  automizor/utils/__init__.py,sha256=W0JNrn7GByjJXi60djS6vluo__Tj6AyJioqu9D41tto,952
13
13
  automizor/vault/__init__.py,sha256=21Ag2zQk7x27Bh0yt_kSO2MkgT3eafbdlKe0NuQEqr8,1796
14
14
  automizor/vault/_container.py,sha256=-2y7kASigoIVAebuQBk-0R_sI4gfmvjsMLuMg_tR1xA,1945
15
- automizor/vault/_vault.py,sha256=-Xi_xMQLRB9patFTiZ4Z817F9VEvhIvx-YOOH8z_BKc,5020
16
- automizor-0.4.9.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
17
- automizor-0.4.9.dist-info/METADATA,sha256=uNVJ3mjxM7iZZRRzbzTCdCE6FlUYdkXiNqLCJZZSG_c,668
18
- automizor-0.4.9.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
19
- automizor-0.4.9.dist-info/top_level.txt,sha256=gScDy4I3tP6BMYAsTAlBXrxVh3E00zV0UioxwXJOI3Y,10
20
- automizor-0.4.9.dist-info/RECORD,,
15
+ automizor/vault/_vault.py,sha256=WTKmm4QQhnBx2oWvYRuXi4hQEcf0srlJ64EN1hUJa6o,5078
16
+ automizor-0.4.10.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
17
+ automizor-0.4.10.dist-info/METADATA,sha256=plaIwWyN4HB2QZh87NHhHn6uRIvu_4t4Dc5NR6vOYX4,669
18
+ automizor-0.4.10.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
19
+ automizor-0.4.10.dist-info/top_level.txt,sha256=gScDy4I3tP6BMYAsTAlBXrxVh3E00zV0UioxwXJOI3Y,10
20
+ automizor-0.4.10.dist-info/RECORD,,