automizor 0.4.14__py3-none-any.whl → 0.4.16__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.14"
1
+ version = "0.4.16"
@@ -80,7 +80,7 @@ class Action:
80
80
  """
81
81
  url = f"https://{self.url}/api/v2/action/{name}/execute?workspace={workspace}"
82
82
  try:
83
- response = requests.put(url, headers=self.headers, data=payload, timeout=60)
83
+ response = requests.put(url, headers=self.headers, data=payload, timeout=90)
84
84
  response.raise_for_status()
85
85
  return response.json()
86
86
  except requests.HTTPError as exc:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: automizor
3
- Version: 0.4.14
3
+ Version: 0.4.16
4
4
  Summary: Python Automizor framework
5
5
  Home-page: https://github.com/automizor/automizor-python
6
6
  Author: Christian Fischer
@@ -16,4 +16,3 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  License-File: LICENSE
18
18
  Requires-Dist: requests
19
-
@@ -1,15 +1,13 @@
1
- automizor/__init__.py,sha256=ZHzMY5Hn_D0riMdk3ejxPPfGziN2wI2kayO_c5AoArw,19
1
+ automizor/__init__.py,sha256=O7b18uPS1SLiY9Wi-TKn2X2Hx_5j8a4A_4MZLAQFg10,19
2
2
  automizor/exceptions.py,sha256=P5imySIOtG3ZIk2kh41Yod4RnlgTj7Vf0P3M-RuxQJs,1382
3
3
  automizor/utils.py,sha256=UDYuSERa3IrS_1NreBTNBYf6j25ga2AiwRdq0c3kfvM,965
4
4
  automizor/action/__init__.py,sha256=nZinP2WYc8Da3rxE10Ul0V31GbEFXRgCYXtBOQ-0LwQ,767
5
- automizor/action/_action.py,sha256=XpwgRLLPLTjxaYojBWymlu9WRY5KWU_VMhKT-T6HzRc,2897
5
+ automizor/action/_action.py,sha256=Gh_S5EAHApKFtDeJuN5K_tbPJSxy4z7MUmUIb9YVcSI,2897
6
6
  automizor/datastore/__init__.py,sha256=_rAdRfKnTa4SuSLl9GkAYziBPPLsy6yGfS0HprgokOk,2418
7
7
  automizor/datastore/_container.py,sha256=rHRkSWaRgy2rk6Qy-7ADFKvuET_COZ2i9VD7gvRDnlM,745
8
8
  automizor/datastore/_datastore.py,sha256=Tv0vRjIyeUfVy3V8pcZVN1dX7q7v8JbJ9L3SCIxX8aM,3396
9
9
  automizor/job/__init__.py,sha256=pDqSfR4lAyJNCi-fpG6byUPidHz8sntBs0bB2lJFVAY,1118
10
10
  automizor/job/_job.py,sha256=XJX9Q7GeOErb7U9Wb01Wv1twIlBqNnJePb0Epc8NdTs,5440
11
- automizor/log/__init__.py,sha256=gEr2SuwN1FgX1NMnbphjg8_gfSic9L15H3WC868A-TQ,2104
12
- automizor/log/_log.py,sha256=P9jAFXVANs5bAGH6-S0pzuSbRKEcX8VlQ_3uu690awE,2948
13
11
  automizor/storage/__init__.py,sha256=vCez0LucHQeRZDfX5xZulxf06i3ezVyFl4vL3-EYXXU,4160
14
12
  automizor/storage/_storage.py,sha256=x5gPxGkzQe21wDDnCLtmVWU0g9JeklPu9iIYVlPDRnk,11381
15
13
  automizor/vault/__init__.py,sha256=21Ag2zQk7x27Bh0yt_kSO2MkgT3eafbdlKe0NuQEqr8,1796
@@ -17,8 +15,8 @@ automizor/vault/_container.py,sha256=-2y7kASigoIVAebuQBk-0R_sI4gfmvjsMLuMg_tR1xA
17
15
  automizor/vault/_vault.py,sha256=pXS1Qcltjh48n9R0NX4q7PSpXT_XFjifRy9Hu4aQnUQ,5104
18
16
  automizor/workflow/__init__.py,sha256=J1K_ogAvbeREPbAmVxsAI1SOVHi_5DXnO9JuEKOMdt8,958
19
17
  automizor/workflow/_workflow.py,sha256=XhcDNBmORdqErj25sO1yb2koKObAFXVkgXrV7xx3EtI,3567
20
- automizor-0.4.14.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
21
- automizor-0.4.14.dist-info/METADATA,sha256=gMQIRSI8jvpEC6eNgcL4jDWkfEPimep-RvYmKaXmcS0,669
22
- automizor-0.4.14.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
23
- automizor-0.4.14.dist-info/top_level.txt,sha256=gScDy4I3tP6BMYAsTAlBXrxVh3E00zV0UioxwXJOI3Y,10
24
- automizor-0.4.14.dist-info/RECORD,,
18
+ automizor-0.4.16.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
19
+ automizor-0.4.16.dist-info/METADATA,sha256=-2IldzFlFJgApP0sH4ndITwcmjldY0z8_eleqY-SZrQ,668
20
+ automizor-0.4.16.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
21
+ automizor-0.4.16.dist-info/top_level.txt,sha256=gScDy4I3tP6BMYAsTAlBXrxVh3E00zV0UioxwXJOI3Y,10
22
+ automizor-0.4.16.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
automizor/log/__init__.py DELETED
@@ -1,95 +0,0 @@
1
- from functools import lru_cache
2
-
3
- from ._log import VALUE
4
-
5
-
6
- @lru_cache
7
- def _get_log():
8
- from ._log import Log
9
-
10
- return Log()
11
-
12
-
13
- def debug(msg: VALUE):
14
- """
15
- Writes a debug log message with a level of "DEBUG".
16
-
17
- Parameters:
18
- msg (VALUE): The log message to write. This can be a boolean, string, integer, float
19
- or a JSON-serializable dictionary or list.
20
- """
21
-
22
- _get_log().write_log("DEBUG", msg)
23
-
24
-
25
- def info(msg: VALUE):
26
- """
27
- Writes an info log message with a level of "INFO".
28
-
29
- Parameters:
30
- msg (VALUE): The log message to write. This can be a boolean, string, integer, float
31
- or a JSON-serializable dictionary or list.
32
- """
33
-
34
- _get_log().write_log("INFO", msg)
35
-
36
-
37
- def warning(msg: VALUE):
38
- """
39
- Writes a warning log message with a level of "WARNING".
40
-
41
- Parameters:
42
- msg (VALUE): The log message to write. This can be a boolean, string, integer, float
43
- or a JSON-serializable dictionary or list.
44
- """
45
-
46
- _get_log().write_log("WARNING", msg)
47
-
48
-
49
- def error(msg: VALUE):
50
- """
51
- Writes an error log message with a level of "ERROR".
52
-
53
- Parameters:
54
- msg (VALUE): The log message to write. This can be a boolean, string, integer, float
55
- or a JSON-serializable dictionary or list.
56
- """
57
-
58
- _get_log().write_log("ERROR", msg)
59
-
60
-
61
- def critical(msg: VALUE):
62
- """
63
- Writes a critical log message with a level of "CRITICAL".
64
-
65
- Parameters:
66
- msg (VALUE): The log message to write. This can be a boolean, string, integer, float
67
- or a JSON-serializable dictionary or list.
68
- """
69
-
70
- _get_log().write_log("CRITICAL", msg)
71
-
72
-
73
- def set_level(level: str):
74
- """
75
- Set the log level for filtering log messages.
76
-
77
- Parameters:
78
- level (str): The log level to set. Valid log levels are "DEBUG", "INFO",
79
- "WARNING", "ERROR", and "CRITICAL".
80
-
81
- Raises:
82
- ValueError: If an invalid log level is provided.
83
- """
84
-
85
- _get_log().set_level(level)
86
-
87
-
88
- __all__ = [
89
- "debug",
90
- "info",
91
- "warning",
92
- "error",
93
- "critical",
94
- "set_level",
95
- ]
automizor/log/_log.py DELETED
@@ -1,97 +0,0 @@
1
- import json
2
- import os
3
- from datetime import datetime, timezone
4
- from typing import Dict, List, Union
5
-
6
- LOG_LEVELS = {
7
- "DEBUG": 1,
8
- "INFO": 2,
9
- "WARNING": 3,
10
- "ERROR": 4,
11
- "CRITICAL": 5,
12
- }
13
-
14
- JSON = Union[str, int, float, bool, None, Dict[str, "JSON"], List["JSON"]]
15
- VALUE = Union[str, int, float, bool, JSON]
16
-
17
-
18
- class Log:
19
- """
20
- `Log` is a class that facilitates logging messages to a local file, which can be
21
- useful for debugging and monitoring purposes. It provides a simple interface for
22
- writing log messages with different levels, such as "info", "warning", "error", etc.
23
-
24
- The log messages are stored in a JSON file, which can be easily parsed and analyzed
25
- later. This class does not provide any log rotation or cleanup mechanisms, so it is
26
- recommended to manage log files manually or use external log management tools.
27
-
28
- Example usage:
29
-
30
- .. code-block:: python
31
-
32
- from automizor import log
33
-
34
- # Set log level to INFO
35
- log.set_level("INFO")
36
-
37
- # Write a log message
38
- log.info("This is an info message")
39
- """
40
-
41
- def __init__(self):
42
- self.level = "INFO"
43
-
44
- def set_level(self, level: str):
45
- """
46
- Set the log level for filtering log messages.
47
-
48
- Parameters:
49
- level (str): The log level to set. Valid log levels are "DEBUG", "INFO",
50
- "WARNING", "ERROR", and "CRITICAL".
51
-
52
- Raises:
53
- ValueError: If an invalid log level is provided.
54
- """
55
-
56
- if level not in LOG_LEVELS:
57
- raise ValueError(f"Invalid log level: {level}")
58
-
59
- self.level = level
60
-
61
- def write_log(self, level: str, msg: VALUE):
62
- """
63
- Write a log message with the specified log level.
64
-
65
- Parameters:
66
- level (str): The log level of the message. Valid log levels are "DEBUG", "INFO",
67
- "WARNING", "ERROR", and "CRITICAL".
68
- msg (VALUE): The log message to write. This can be a boolean, string, integer, float
69
- or a JSON-serializable dictionary or list.
70
-
71
- Raises:
72
- ValueError: If an invalid log level is provided.
73
- """
74
-
75
- if level not in LOG_LEVELS:
76
- raise ValueError(f"Invalid log level: {level}")
77
-
78
- if LOG_LEVELS[level] < LOG_LEVELS[self.level]:
79
- return
80
-
81
- data = []
82
- file_path = "output/log.json"
83
- try:
84
- if os.path.exists(file_path):
85
- with open(file_path, "r", encoding="utf-8") as file:
86
- data = json.load(file)
87
- except json.JSONDecodeError:
88
- pass
89
-
90
- if isinstance(msg, (dict, list)):
91
- msg = json.dumps(msg, ensure_ascii=False)
92
-
93
- timestamp = datetime.now(timezone.utc).isoformat()
94
- data.append({"level": level, "msg": msg, "timestamp": timestamp})
95
-
96
- with open(file_path, "w", encoding="utf-8") as file:
97
- json.dump(data, file, ensure_ascii=False)