pyxecm 1.6__py3-none-any.whl → 2.0.1__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.

Potentially problematic release.


This version of pyxecm might be problematic. Click here for more details.

Files changed (78) hide show
  1. pyxecm/__init__.py +7 -4
  2. pyxecm/avts.py +727 -254
  3. pyxecm/coreshare.py +686 -467
  4. pyxecm/customizer/__init__.py +16 -4
  5. pyxecm/customizer/__main__.py +58 -0
  6. pyxecm/customizer/api/__init__.py +5 -0
  7. pyxecm/customizer/api/__main__.py +6 -0
  8. pyxecm/customizer/api/app.py +163 -0
  9. pyxecm/customizer/api/auth/__init__.py +1 -0
  10. pyxecm/customizer/api/auth/functions.py +92 -0
  11. pyxecm/customizer/api/auth/models.py +13 -0
  12. pyxecm/customizer/api/auth/router.py +78 -0
  13. pyxecm/customizer/api/common/__init__.py +1 -0
  14. pyxecm/customizer/api/common/functions.py +47 -0
  15. pyxecm/customizer/api/common/metrics.py +92 -0
  16. pyxecm/customizer/api/common/models.py +21 -0
  17. pyxecm/customizer/api/common/payload_list.py +870 -0
  18. pyxecm/customizer/api/common/router.py +72 -0
  19. pyxecm/customizer/api/settings.py +128 -0
  20. pyxecm/customizer/api/terminal/__init__.py +1 -0
  21. pyxecm/customizer/api/terminal/router.py +87 -0
  22. pyxecm/customizer/api/v1_csai/__init__.py +1 -0
  23. pyxecm/customizer/api/v1_csai/router.py +87 -0
  24. pyxecm/customizer/api/v1_maintenance/__init__.py +1 -0
  25. pyxecm/customizer/api/v1_maintenance/functions.py +100 -0
  26. pyxecm/customizer/api/v1_maintenance/models.py +12 -0
  27. pyxecm/customizer/api/v1_maintenance/router.py +76 -0
  28. pyxecm/customizer/api/v1_otcs/__init__.py +1 -0
  29. pyxecm/customizer/api/v1_otcs/functions.py +61 -0
  30. pyxecm/customizer/api/v1_otcs/router.py +179 -0
  31. pyxecm/customizer/api/v1_payload/__init__.py +1 -0
  32. pyxecm/customizer/api/v1_payload/functions.py +179 -0
  33. pyxecm/customizer/api/v1_payload/models.py +51 -0
  34. pyxecm/customizer/api/v1_payload/router.py +499 -0
  35. pyxecm/customizer/browser_automation.py +721 -286
  36. pyxecm/customizer/customizer.py +1076 -1425
  37. pyxecm/customizer/exceptions.py +35 -0
  38. pyxecm/customizer/guidewire.py +1186 -0
  39. pyxecm/customizer/k8s.py +901 -379
  40. pyxecm/customizer/log.py +107 -0
  41. pyxecm/customizer/m365.py +2967 -920
  42. pyxecm/customizer/nhc.py +1169 -0
  43. pyxecm/customizer/openapi.py +258 -0
  44. pyxecm/customizer/payload.py +18228 -7820
  45. pyxecm/customizer/pht.py +717 -286
  46. pyxecm/customizer/salesforce.py +516 -342
  47. pyxecm/customizer/sap.py +58 -41
  48. pyxecm/customizer/servicenow.py +611 -372
  49. pyxecm/customizer/settings.py +445 -0
  50. pyxecm/customizer/successfactors.py +408 -346
  51. pyxecm/customizer/translate.py +83 -48
  52. pyxecm/helper/__init__.py +5 -2
  53. pyxecm/helper/assoc.py +83 -43
  54. pyxecm/helper/data.py +2406 -870
  55. pyxecm/helper/logadapter.py +27 -0
  56. pyxecm/helper/web.py +229 -101
  57. pyxecm/helper/xml.py +596 -171
  58. pyxecm/maintenance_page/__init__.py +5 -0
  59. pyxecm/maintenance_page/__main__.py +6 -0
  60. pyxecm/maintenance_page/app.py +51 -0
  61. pyxecm/maintenance_page/settings.py +28 -0
  62. pyxecm/maintenance_page/static/favicon.avif +0 -0
  63. pyxecm/maintenance_page/templates/maintenance.html +165 -0
  64. pyxecm/otac.py +235 -141
  65. pyxecm/otawp.py +2668 -1220
  66. pyxecm/otca.py +569 -0
  67. pyxecm/otcs.py +7956 -3237
  68. pyxecm/otds.py +2178 -925
  69. pyxecm/otiv.py +36 -21
  70. pyxecm/otmm.py +1272 -325
  71. pyxecm/otpd.py +231 -127
  72. pyxecm-2.0.1.dist-info/METADATA +122 -0
  73. pyxecm-2.0.1.dist-info/RECORD +76 -0
  74. {pyxecm-1.6.dist-info → pyxecm-2.0.1.dist-info}/WHEEL +1 -1
  75. pyxecm-1.6.dist-info/METADATA +0 -53
  76. pyxecm-1.6.dist-info/RECORD +0 -32
  77. {pyxecm-1.6.dist-info → pyxecm-2.0.1.dist-info/licenses}/LICENSE +0 -0
  78. {pyxecm-1.6.dist-info → pyxecm-2.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,107 @@
1
+ """Common logging handler for VictoriaLogs and the LogCountFilter."""
2
+
3
+ import contextlib
4
+ import logging
5
+ import socket
6
+ from datetime import datetime, timezone
7
+
8
+ import requests
9
+
10
+ try:
11
+ import pandas as pd
12
+
13
+ pandas_installed = True
14
+ except ModuleNotFoundError:
15
+ pandas_installed = False
16
+
17
+
18
+ class VictoriaLogsHandler(logging.Handler):
19
+ """Logging handler for VictoriaLogs.
20
+
21
+ Args:
22
+ logging (_type_): _description_
23
+
24
+ """
25
+
26
+ def __init__(
27
+ self,
28
+ host: str,
29
+ port: int = 9428,
30
+ accountid: int = 0,
31
+ projectid: int = 0,
32
+ **kwargs: str | int,
33
+ ) -> None:
34
+ """Initialize the log handler.
35
+
36
+ Args:
37
+ host (_type_): _description_
38
+ port (int, optional): _description_. Defaults to 9428.
39
+ accountid (int, optional): _description_. Defaults to 0.
40
+ projectid (int, optional): _description_. Defaults to 0.
41
+ kwargs (dict[str, Any]): ability to add additional arguments into the request body
42
+
43
+ """
44
+ logging.Handler.__init__(self)
45
+ self.url = f"http://{host}:{port}/insert/jsonline?_stream_fields=host,app&_msg_field=msg&_time_field=time"
46
+ self.accountid = accountid
47
+ self.projectid = projectid
48
+ self.kwargs = kwargs
49
+
50
+ def emit(self, record: logging.LogRecord) -> None:
51
+ """Send request to VictoriaLogs.
52
+
53
+ Args:
54
+ record (_type_): _description_
55
+
56
+ """
57
+ payload = {
58
+ "host": socket.gethostname(),
59
+ "processid": record.process,
60
+ "logger": record.name,
61
+ "level": record.levelname,
62
+ "thread": record.threadName,
63
+ "threadid": record.thread,
64
+ "time": datetime.now(timezone.utc).isoformat(),
65
+ "msg": f"[{record.levelname}] {record.getMessage()}",
66
+ "module": record.module,
67
+ }
68
+ payload.update(self.kwargs)
69
+
70
+ headers = {
71
+ "Content-type": "application/json",
72
+ "AccountID": str(self.accountid),
73
+ "ProjectID": str(self.projectid),
74
+ }
75
+
76
+ with contextlib.suppress(Exception):
77
+ requests.post(self.url, headers=headers, json=payload, timeout=1)
78
+
79
+
80
+ class LogCountFilter(logging.Filter):
81
+ """LogFilter to be assinged to thread_logger to count the number os messages by level."""
82
+
83
+ def __init__(self, payload_items: pd.DataFrame, index: int) -> None:
84
+ """LogCountFilter initializer.
85
+
86
+ Args:
87
+ payload_items (pd.DataFrame): _description_
88
+ index (int): _description_
89
+
90
+ """
91
+ super().__init__()
92
+ self.index = index
93
+ self.payload_items = payload_items
94
+
95
+ def filter(self, record: logging.LogRecord) -> bool:
96
+ """Filter method.
97
+
98
+ Args:
99
+ record (_type_): _description_
100
+
101
+ Returns:
102
+ bool: _description_
103
+
104
+ """
105
+ level_name = (record.levelname).lower()
106
+ self.payload_items.loc[self.index, f"log_{level_name}"] += 1
107
+ return True