afgutils 1.3.2__tar.gz → 1.4.1__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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: afgutils
3
- Version: 1.3.2
3
+ Version: 1.4.1
4
4
  Summary: Shared support functions
5
5
  Author: Araz Heydarov
6
6
  Author-email: araz.heydarov@asiafinancegroup.com
@@ -13,5 +13,12 @@ Requires-Dist: python-dotenv>=1.0.0
13
13
  Requires-Dist: boto3>=1.27.0
14
14
  Requires-Dist: pandas>=2.0.3
15
15
  Requires-Dist: xmltodict>=0.13.0
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: description
19
+ Dynamic: license
20
+ Dynamic: requires-dist
21
+ Dynamic: requires-python
22
+ Dynamic: summary
16
23
 
17
24
  Shared support functions
@@ -33,7 +33,7 @@ class DB:
33
33
 
34
34
  if dsn:
35
35
  conn_str = f"DSN={dsn}"
36
- elif prefix and driver and driver and user and password and server and port:
36
+ elif prefix and driver and user and password and server and port:
37
37
  conn_str = (
38
38
  f"DRIVER={driver};"
39
39
  f"DATABASE={database};"
@@ -29,6 +29,17 @@ from numpy import bool_
29
29
 
30
30
  # session_token_cookie_name = "uwtool_session_token"
31
31
 
32
+ EVENT_LOG_INSERT_SQL = """
33
+ insert into scorto.event_log (event_src_name, event_src_id, event_type) values (?, ?, ?);
34
+ """
35
+
36
+ def log_event(db_cursor: pyodbc.Cursor, event_src_name: str, event_src_id: str, event_type: str):
37
+ _ = DB.execute(db_cursor, EVENT_LOG_INSERT_SQL,
38
+ fetch=None,
39
+ commit=True,
40
+ parameters=(event_src_name, event_src_id, event_type,)
41
+ )
42
+
32
43
 
33
44
  def print_log(*args, **kwargs) -> None:
34
45
  """Prints a line preceeded by a timestamp"""
@@ -84,6 +95,26 @@ def clear_mfv(mfv: dict) -> dict:
84
95
  return mfv
85
96
 
86
97
 
98
+ def http_print(content: str | None = None, content_type: str = "text/plain; charset=utf-8", headers: dict[str, str] | None = None) -> \
99
+ None:
100
+ headers_actual={
101
+ "Status": "200 OK"
102
+ ,"Content-Type": content_type
103
+ ,"Cache-Control": "no-store"
104
+ }
105
+
106
+ if headers is not None:
107
+ for key in headers:
108
+ headers_actual[key] = headers[key]
109
+ # Overwrite any default headers if provided in headers dict
110
+
111
+ for key in headers_actual:
112
+ print(key + ": " + headers_actual[key])
113
+
114
+ print("")
115
+ if content is not None: print(content)
116
+
117
+
87
118
  # def get_username()-> str:
88
119
  # conn_repserv = DB.get_connection('repserv')
89
120
  # cursor_repserv = conn_repserv.cursor()
@@ -221,7 +252,7 @@ parse_row_into_object = parse_dict_into_object # added for legacy compatibility
221
252
 
222
253
  class AfgBaseMixin:
223
254
  """
224
- Base extension for all AFG objects; restricts operations on private and callabe attributes.
255
+ Base extension for all AFG objects; restricts operations on private and callable attributes.
225
256
 
226
257
  __str__ ommits private and callable attributes
227
258
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: afgutils
3
- Version: 1.3.2
3
+ Version: 1.4.1
4
4
  Summary: Shared support functions
5
5
  Author: Araz Heydarov
6
6
  Author-email: araz.heydarov@asiafinancegroup.com
@@ -13,5 +13,12 @@ Requires-Dist: python-dotenv>=1.0.0
13
13
  Requires-Dist: boto3>=1.27.0
14
14
  Requires-Dist: pandas>=2.0.3
15
15
  Requires-Dist: xmltodict>=0.13.0
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: description
19
+ Dynamic: license
20
+ Dynamic: requires-dist
21
+ Dynamic: requires-python
22
+ Dynamic: summary
16
23
 
17
24
  Shared support functions
@@ -1,6 +1,6 @@
1
1
  from setuptools import find_packages, setup
2
2
 
3
- VERSION = "1.3.2"
3
+ VERSION = "1.4.1"
4
4
  DESCRIPTION = "Shared support functions"
5
5
  LONG_DESCRIPTION = "Shared support functions"
6
6
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes