python-sdk-remote 0.0.71__tar.gz → 0.0.72__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.

Potentially problematic release.


This version of python-sdk-remote might be problematic. Click here for more details.

Files changed (21) hide show
  1. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/PKG-INFO +2 -1
  2. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/README.md +7 -4
  3. python-sdk-remote-0.0.72/pyproject.toml +18 -0
  4. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote/src/mini_logger.py +9 -9
  5. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote/src/our_object.py +17 -9
  6. python-sdk-remote-0.0.72/python_sdk_remote/src/unified_json.py +27 -0
  7. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote/src/utilities.py +47 -50
  8. python-sdk-remote-0.0.72/python_sdk_remote/src/valid_json_versions.py +4 -0
  9. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote.egg-info/PKG-INFO +2 -1
  10. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote.egg-info/SOURCES.txt +1 -2
  11. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote.egg-info/requires.txt +1 -0
  12. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/setup.py +4 -3
  13. python-sdk-remote-0.0.71/pyproject.toml +0 -12
  14. python-sdk-remote-0.0.71/python_sdk_remote/src/constants.py +0 -20
  15. python-sdk-remote-0.0.71/python_sdk_remote/src/unified_json.py +0 -13
  16. python-sdk-remote-0.0.71/python_sdk_remote/src/validate_environment.py +0 -42
  17. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote/src/__init__.py +0 -0
  18. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote/src/item.py +0 -0
  19. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
  20. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/python_sdk_remote.egg-info/top_level.txt +0 -0
  21. {python-sdk-remote-0.0.71 → python-sdk-remote-0.0.72}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-remote
3
- Version: 0.0.71
3
+ Version: 0.0.72
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles-zone/python-sdk-remote-python-package
6
6
  Author: Circles
@@ -10,5 +10,6 @@ Classifier: License :: Other/Proprietary License
10
10
  Classifier: Operating System :: OS Independent
11
11
  Description-Content-Type: text/markdown
12
12
  Requires-Dist: python-dotenv
13
+ Requires-Dist: url-remote
13
14
 
14
15
  This is a package for sharing common functions used in different repositories
@@ -1,21 +1,24 @@
1
1
  # python-package-backend-template
2
+
2
3
  To create local package and remote package layers (not to create GraphQL and REST-API layers)
3
4
 
4
5
  #database Python scripts in /db folder
5
6
  Please place <table-name>.py in /db<br>
6
7
  No need for seperate file for _ml table<br>
7
8
  Please delete the example file if not needed<br>
8
-
9
+
9
10
  # Create the files to create the database schema, tables, view and populate Meta Data and Test Date
11
+
10
12
  /db/<table-name>.py - CREATE SCHEMA ... CREATE TABLE ... CREATE VIEW ...<br>
11
13
  /db/<table-name>_insert.py to create records
12
14
 
13
15
  # Update the setup.py (i.e.name, version)
14
-
16
+
15
17
  # Please create test directory inside the directory of the project i.e. /<project-name>/tests
16
18
 
17
19
  # Update the serverless.yml in the root directory
20
+
18
21
  provider:
19
- stage: play1
20
-
22
+ stage: play1
23
+
21
24
  Update the endpoints in serverless.yml
@@ -0,0 +1,18 @@
1
+ # This file should be in the future instead of setup.py
2
+ # https://python-poetry.org/docs/pyproject
3
+
4
+ # It seems we need to copy this file also to serverless-com repo, as required by dialog-workflow-python-package
5
+
6
+ [build-system]
7
+ requires = ["setuptools>=61.0"]
8
+ build-backend = "setuptools.build_meta"
9
+
10
+ [tool.poetry]
11
+ name = "python-sdk-local"
12
+ # I believe we are still using the version from setup.py and not from here until potery will work
13
+ version = "0.0.1" # https://pypi.org/project/python-sdk-local i.e. https://pypi.org/project/storage-local/
14
+ description = "python-sdk-local Python Package"
15
+ readme = "README.md"
16
+ authors = [
17
+ "Circlez.ai <info@circlez.ai>",
18
+ ]
@@ -17,7 +17,7 @@ class MiniLogger:
17
17
  if object is None:
18
18
  print(f"{datetime.now()} - START - {message}")
19
19
  else:
20
- print(f"{datetime.now()} - START - {message} - {str(object)}")
20
+ print(f"{datetime.now()} - START - {message} - {object}")
21
21
 
22
22
  @staticmethod
23
23
  def end(message: str = "", object: dict = None):
@@ -30,7 +30,7 @@ class MiniLogger:
30
30
  if object is None:
31
31
  print(f"{datetime.now()} - END - {message}")
32
32
  else:
33
- print(f"{datetime.now()} - END - {message} - {str(object)}")
33
+ print(f"{datetime.now()} - END - {message} - {object}")
34
34
 
35
35
  @staticmethod
36
36
  def info(message: str = "", object: dict = None):
@@ -44,7 +44,7 @@ class MiniLogger:
44
44
  if object is None:
45
45
  print(f"{datetime.now()} - INFO - {message}")
46
46
  else:
47
- print(f"{datetime.now()} - INFO {message} - {str(object)}")
47
+ print(f"{datetime.now()} - INFO {message} - {object}")
48
48
 
49
49
  @staticmethod
50
50
  def warning(message: str = "", object: dict = None):
@@ -58,7 +58,7 @@ class MiniLogger:
58
58
  if object is None:
59
59
  print(f"{datetime.now()} - WARNING - {message}")
60
60
  else:
61
- print(f"{datetime.now()} - WARNING {message} - {str(object)}")
61
+ print(f"{datetime.now()} - WARNING {message} - {object}")
62
62
 
63
63
  @staticmethod
64
64
  def error(message: str = "", object: dict = None):
@@ -70,22 +70,22 @@ class MiniLogger:
70
70
  object (dict): The object to be printed.
71
71
  """
72
72
  if object is None:
73
- print(f"{datetime.now()} - ERROR - {message}", file=sys.stderr)
73
+ print(f"{datetime.now()} - ERROR - {message}", file=sys.stderr)
74
74
  else:
75
75
  print(
76
- f"{datetime.now()} - ERROR - {message} - {str(object)}", file=sys.stderr)
76
+ f"{datetime.now()} - ERROR - {message} - {object}", file=sys.stderr)
77
77
 
78
78
  @staticmethod
79
- def exception(message: str = "", object: dict = None):
79
+ def exception(message: str = "", object: Exception | dict = None):
80
80
  """
81
81
  Print a log error message with the current time.
82
82
 
83
83
  Parameters:
84
84
  message (str): The message to be printed.
85
- object (dict): The object to be printed.
85
+ object (dict / Exception): The object / Exception to be printed.
86
86
  """
87
87
  if object is None:
88
88
  print(f"{datetime.now()} - EXCEPTION - {message}", file=sys.stderr)
89
89
  else:
90
90
  print(
91
- f"{datetime.now()} - EXCEPTION- {message} - {str(object)}", file=sys.stderr)
91
+ f"{datetime.now()} - EXCEPTION- {message} - {object}", file=sys.stderr)
@@ -1,48 +1,56 @@
1
1
  import json
2
2
  from abc import ABC, abstractmethod
3
3
 
4
- from .mini_logger import MiniLogger
4
+ from .mini_logger import MiniLogger as logger
5
5
 
6
6
 
7
+ # TODO Where are we using it? Shall we extend the usage of OurObject as the father of all our entities?
7
8
  class OurObject(ABC):
8
9
  def __init__(self, **kwargs):
9
10
  INIT_METHOD_NAME = '__init__'
10
- MiniLogger.start(INIT_METHOD_NAME, object={'kwargs': kwargs})
11
+ logger.start(INIT_METHOD_NAME, object={'kwargs': kwargs})
11
12
  self.kwargs = kwargs
12
- MiniLogger.end(INIT_METHOD_NAME, object={'kwargs': kwargs})
13
+ logger.end(INIT_METHOD_NAME, object={'kwargs': kwargs})
13
14
 
14
15
  @abstractmethod
15
16
  def get_name(self):
17
+ """Returns the name of the object"""
16
18
  raise NotImplementedError(
17
19
  "Subclasses must implement the 'get_name' method.")
18
20
 
19
21
  def get(self, attr_name: str):
22
+ """Returns the value of the attribute with the given name"""
20
23
  GET_METHOD_NAME = 'get'
21
- MiniLogger.start(GET_METHOD_NAME, object={'attr_name': attr_name})
24
+ logger.start(GET_METHOD_NAME, object={'attr_name': attr_name})
22
25
  arguments = getattr(self, 'kwargs', None)
23
26
  value = arguments.get(attr_name, None)
24
- MiniLogger.end(GET_METHOD_NAME, object={'attr_name': attr_name})
27
+ logger.end(GET_METHOD_NAME, object={'attr_name': attr_name})
25
28
  return value
26
29
 
27
30
  def get_all_arguments(self):
31
+ """Returns all the arguments passed to the constructor as a dictionary"""
28
32
  return getattr(self, 'kwargs', None)
29
33
 
30
34
  def to_json(self) -> str:
35
+ """Returns a json string representation of this object"""
31
36
  return json.dumps(self.__dict__)
32
37
 
33
38
  def from_json(self, json_string: str) -> 'OurObject':
39
+ """Returns an instance of the class from a json string"""
34
40
  FROM_JSON_METHOD_NAME = 'from_json'
35
- MiniLogger.start(FROM_JSON_METHOD_NAME,
36
- object={'json_string': json_string})
41
+ logger.start(FROM_JSON_METHOD_NAME,
42
+ object={'json_string': json_string})
37
43
  self.__dict__ = json.loads(json_string)
38
- MiniLogger.end(FROM_JSON_METHOD_NAME,
39
- object={'json_dict': self.__dict__})
44
+ logger.end(FROM_JSON_METHOD_NAME,
45
+ object={'json_dict': self.__dict__})
40
46
  return self
41
47
 
42
48
  def __eq__(self, other) -> bool:
49
+ """Checks if two objects are equal"""
43
50
  if not isinstance(other, OurObject):
44
51
  return False
45
52
  return self.__dict__ == other.__dict__
46
53
 
47
54
  def __ne__(self, other) -> bool:
55
+ """Checks if two objects are not equal"""
48
56
  return not self.__eq__(other)
@@ -0,0 +1,27 @@
1
+ from .valid_json_versions import valid_json_versions
2
+
3
+
4
+ class UnifiedJson:
5
+ def __init__(self, data: dict, json_version: str):
6
+ if json_version not in valid_json_versions:
7
+ raise Exception(
8
+ f"version {json_version} is not in valid_json_versions {valid_json_versions}, "
9
+ f"please make sure you run sql2code."
10
+ )
11
+ self.json_version = json_version
12
+ self.data = data
13
+
14
+ def get_unified_json(self):
15
+ return {"version": self.json_version, "data": self.data}
16
+
17
+ def get_data(self):
18
+ return self.data
19
+
20
+ def get_json_version(self):
21
+ return self.json_version
22
+
23
+ def __str__(self):
24
+ return self.get_unified_json()
25
+
26
+ def __repr__(self):
27
+ return self.__str__()
@@ -1,17 +1,13 @@
1
- import os
2
1
  import json
2
+ import os
3
3
  from datetime import date, datetime, time, timedelta
4
4
  from urllib.parse import urlparse
5
+ from url_remote.environment_name_enum import EnvironmentName
5
6
 
6
- from .mini_logger import MiniLogger
7
-
8
- from .constants import (BRAND_NAME, ENVIRONMENT_NAME) # noqa: E402
9
-
10
- from .validate_environment import (validate_brand_name, # noqa: E402
11
- validate_environment_name)
12
-
7
+ from dotenv import load_dotenv
13
8
 
14
- RANGE_LENGTH = 2
9
+ from .mini_logger import MiniLogger as logger
10
+ load_dotenv()
15
11
 
16
12
 
17
13
  def timedelta_to_time_format(time_delta: timedelta) -> str:
@@ -31,10 +27,10 @@ def timedelta_to_time_format(time_delta: timedelta) -> str:
31
27
  >>> duration = timedelta(hours=2, minutes=30, seconds=45)
32
28
  >>> formatted_time = timedelta_to_time_format(duration)
33
29
  >>> print(formatted_time)
34
- '02:30:45'
30
+ "02:30:45"
35
31
  """
36
32
  TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME = "timedelta_to_time_format"
37
- MiniLogger.start(TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME, object={'time_delta': time_delta})
33
+ logger.start(TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME, object={'time_delta': time_delta})
38
34
 
39
35
  # Calculate the total seconds and convert to HH:MM:SS format
40
36
  total_seconds = int(time_delta.total_seconds())
@@ -45,8 +41,8 @@ def timedelta_to_time_format(time_delta: timedelta) -> str:
45
41
  # Format as "HH:MM:SS"
46
42
  formatted_time = f"{hours:02d}:{minutes:02d}:{seconds:02d}"
47
43
 
48
- MiniLogger.end(TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME,
49
- object={'formatted_time': formatted_time})
44
+ logger.end(TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME,
45
+ object={'formatted_time': formatted_time})
50
46
  return formatted_time
51
47
 
52
48
 
@@ -55,25 +51,25 @@ def is_valid_time_range(time_range: tuple) -> bool:
55
51
  Validate that the time range is in the format 'HH:MM:SS'.
56
52
  """
57
53
  IS_VALID_TIME_RANGE_METHOD_NAME = "is_valid_time_range"
58
- MiniLogger.start(IS_VALID_TIME_RANGE_METHOD_NAME, object={
54
+ logger.start(IS_VALID_TIME_RANGE_METHOD_NAME, object={
59
55
  "time_range": time_range.__str__()})
60
- if len(time_range) != RANGE_LENGTH:
61
- MiniLogger.end(IS_VALID_TIME_RANGE_METHOD_NAME, object={
56
+ if len(time_range) != 2:
57
+ logger.end(IS_VALID_TIME_RANGE_METHOD_NAME, object={
62
58
  "is_valid_time_range_result": False, "reason": "len(time_range) != 2"})
63
59
  return False
64
60
 
65
61
  for time_obj in time_range:
66
62
  if not isinstance(time_obj, time):
67
- MiniLogger.end(IS_VALID_TIME_RANGE_METHOD_NAME, object={
63
+ logger.end(IS_VALID_TIME_RANGE_METHOD_NAME, object={
68
64
  "is_valid_time_range_result": False, "reason": "time_range contains non-time objects"})
69
65
  return False
70
66
  time_str = time_obj.strftime('%H:%M:%S')
71
67
  if time_obj.strftime('%H:%M:%S') != time_str:
72
- MiniLogger.end(IS_VALID_TIME_RANGE_METHOD_NAME, object={
68
+ logger.end(IS_VALID_TIME_RANGE_METHOD_NAME, object={
73
69
  "is_valid_time_range_result": False, "reason": "time_range contains invalid time format"})
74
70
  return False
75
71
 
76
- MiniLogger.end(IS_VALID_TIME_RANGE_METHOD_NAME, object={
72
+ logger.end(IS_VALID_TIME_RANGE_METHOD_NAME, object={
77
73
  "is_valid_time_range_result": True})
78
74
  return True
79
75
 
@@ -90,19 +86,19 @@ def is_valid_date_range(date_range: tuple) -> bool:
90
86
  Validate that the date range is in the format 'YYYY-MM-DD'.
91
87
  """
92
88
  IS_VALID_DATE_RANGE_METHOD_NAME = "is_valid_date_range"
93
- MiniLogger.start(IS_VALID_DATE_RANGE_METHOD_NAME, object={
89
+ logger.start(IS_VALID_DATE_RANGE_METHOD_NAME, object={
94
90
  "date_range": date_range.__str__()})
95
- if len(date_range) != RANGE_LENGTH:
96
- MiniLogger.end(IS_VALID_DATE_RANGE_METHOD_NAME, object={
91
+ if len(date_range) != 2:
92
+ logger.end(IS_VALID_DATE_RANGE_METHOD_NAME, object={
97
93
  "is_valid_date_range_result": False, "reason": "len(date_range) != 2"})
98
94
  return False
99
95
 
100
96
  for date_obj in date_range:
101
97
  if not isinstance(date_obj, date):
102
- MiniLogger.end(IS_VALID_DATE_RANGE_METHOD_NAME, object={
98
+ logger.end(IS_VALID_DATE_RANGE_METHOD_NAME, object={
103
99
  "is_valid_date_range_result": False, "reason": "date_range contains non-date objects"})
104
100
  return False
105
- MiniLogger.end(IS_VALID_DATE_RANGE_METHOD_NAME, object={
101
+ logger.end(IS_VALID_DATE_RANGE_METHOD_NAME, object={
106
102
  "is_valid_date_range_result": True})
107
103
  return True
108
104
 
@@ -112,19 +108,19 @@ def is_valid_datetime_range(datetime_range: tuple) -> bool:
112
108
  Validate that the datetime range is in the format 'YYYY-MM-DD HH:MM:SS'.
113
109
  """
114
110
  IS_VALID_DATETIME_RANGE_METHOD_NAME = "is_valid_datetime_range"
115
- MiniLogger.start(IS_VALID_DATETIME_RANGE_METHOD_NAME, object={
111
+ logger.start(IS_VALID_DATETIME_RANGE_METHOD_NAME, object={
116
112
  "datetime_range": datetime_range.__str__()})
117
- if len(datetime_range) != RANGE_LENGTH:
118
- MiniLogger.end(IS_VALID_DATETIME_RANGE_METHOD_NAME, object={
113
+ if len(datetime_range) != 2:
114
+ logger.end(IS_VALID_DATETIME_RANGE_METHOD_NAME, object={
119
115
  "is_valid_datetime_range_result": False, "reason": "len(datetime_range) != 2"})
120
116
  return False
121
117
 
122
118
  for datetime_obj in datetime_range:
123
119
  if not isinstance(datetime_obj, datetime):
124
- MiniLogger.end(IS_VALID_DATETIME_RANGE_METHOD_NAME, object={
120
+ logger.end(IS_VALID_DATETIME_RANGE_METHOD_NAME, object={
125
121
  "is_valid_datetime_range_result": False, "reason": "datetime_range contains non-datetime objects"})
126
122
  return False
127
- MiniLogger.end(IS_VALID_DATETIME_RANGE_METHOD_NAME, object={
123
+ logger.end(IS_VALID_DATETIME_RANGE_METHOD_NAME, object={
128
124
  "is_valid_datetime_range_result": True})
129
125
  return True
130
126
 
@@ -153,26 +149,27 @@ def is_list_of_dicts(obj):
153
149
  False
154
150
  """
155
151
  IS_LIST_OF_DICTS_FUNCTION_NAME = "is_list_of_dicts"
156
- MiniLogger.start(IS_LIST_OF_DICTS_FUNCTION_NAME, object={"obj": obj})
152
+ logger.start(IS_LIST_OF_DICTS_FUNCTION_NAME, object={"obj": obj})
157
153
  try:
158
154
  if not isinstance(obj, list):
159
155
  is_list_of_dicts_result = False
160
- MiniLogger.end(IS_LIST_OF_DICTS_FUNCTION_NAME, object={
156
+ logger.end(IS_LIST_OF_DICTS_FUNCTION_NAME, object={
161
157
  "is_list_of_dicts_result": is_list_of_dicts_result})
162
158
  return is_list_of_dicts_result
163
159
  for item in obj:
164
160
  if not isinstance(item, dict):
165
161
  is_list_of_dicts_result = False
166
- MiniLogger.end(IS_LIST_OF_DICTS_FUNCTION_NAME, object={
162
+ logger.end(IS_LIST_OF_DICTS_FUNCTION_NAME, object={
167
163
  "is_list_of_dicts_result": is_list_of_dicts_result})
168
164
  return is_list_of_dicts_result
169
165
  is_list_of_dicts_result = True
170
- MiniLogger.end(IS_LIST_OF_DICTS_FUNCTION_NAME, object={
166
+ logger.end(IS_LIST_OF_DICTS_FUNCTION_NAME, object={
171
167
  "is_list_of_dicts_result": is_list_of_dicts_result})
172
168
  return is_list_of_dicts_result
173
- except Exception as e:
174
- MiniLogger.end(IS_LIST_OF_DICTS_FUNCTION_NAME, exception=e)
175
- raise e
169
+ except Exception as exception:
170
+ logger.exception(IS_LIST_OF_DICTS_FUNCTION_NAME, exception)
171
+ logger.end(IS_LIST_OF_DICTS_FUNCTION_NAME)
172
+ raise
176
173
 
177
174
 
178
175
  def is_time_in_time_range(check_time: time, time_range: tuple) -> bool:
@@ -187,14 +184,14 @@ def is_time_in_time_range(check_time: time, time_range: tuple) -> bool:
187
184
  bool: True if the check_time is within the time range, False otherwise.
188
185
  """
189
186
  IS_TIME_IN_TIME_RANGE_METHOD_NAME = "is_time_in_time_range"
190
- MiniLogger.start(IS_TIME_IN_TIME_RANGE_METHOD_NAME, object={
187
+ logger.start(IS_TIME_IN_TIME_RANGE_METHOD_NAME, object={
191
188
  "check_time": check_time.__str__(), "time_range": time_range.__str__()})
192
189
  if not is_valid_time_range(time_range) or not isinstance(check_time, time):
193
- MiniLogger.end(IS_TIME_IN_TIME_RANGE_METHOD_NAME, object={
190
+ logger.end(IS_TIME_IN_TIME_RANGE_METHOD_NAME, object={
194
191
  "is_time_in_time_range_result": False})
195
192
  return False
196
193
  start_time, end_time = time_range
197
- MiniLogger.end(IS_TIME_IN_TIME_RANGE_METHOD_NAME, object={
194
+ logger.end(IS_TIME_IN_TIME_RANGE_METHOD_NAME, object={
198
195
  "is_time_in_time_range_result": start_time <= check_time <= end_time})
199
196
  return start_time <= check_time <= end_time
200
197
 
@@ -211,15 +208,15 @@ def is_date_in_date_range(check_date: date, date_range: tuple) -> bool:
211
208
  bool: True if the check_date is within the date range, False otherwise.
212
209
  """
213
210
  IS_DATE_IN_DATE_RANGE_METHOD_NAME = "is_date_in_date_range"
214
- MiniLogger.start(IS_DATE_IN_DATE_RANGE_METHOD_NAME, object={
211
+ logger.start(IS_DATE_IN_DATE_RANGE_METHOD_NAME, object={
215
212
  "check_date": check_date.__str__(), "date_range": date_range.__str__()})
216
213
  if not is_valid_date_range(date_range) or not isinstance(check_date, date):
217
- MiniLogger.end(IS_DATE_IN_DATE_RANGE_METHOD_NAME, object={
214
+ logger.end(IS_DATE_IN_DATE_RANGE_METHOD_NAME, object={
218
215
  "is_date_in_date_range_result": False})
219
216
  return False
220
217
 
221
218
  start_date, end_date = date_range
222
- MiniLogger.end(IS_DATE_IN_DATE_RANGE_METHOD_NAME, object={
219
+ logger.end(IS_DATE_IN_DATE_RANGE_METHOD_NAME, object={
223
220
  "is_date_in_date_range_result": start_date <= check_date <= end_date})
224
221
  return start_date <= check_date <= end_date
225
222
 
@@ -236,15 +233,15 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: tupl
236
233
  bool: True if the check_datetime is within the datetime range, False otherwise.
237
234
  """
238
235
  IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME = "is_datetime_in_datetime_range"
239
- MiniLogger.start(IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME)
236
+ logger.start(IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME)
240
237
  if not is_valid_datetime_range(datetime_range) or not isinstance(check_datetime, datetime):
241
- MiniLogger.end(IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME, object={
238
+ logger.end(IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME, object={
242
239
  "is_valid_datetime_range": False})
243
240
  return False
244
241
 
245
242
  start_datetime, end_datetime = datetime_range
246
243
  is_datetime_in_datetime_range_result = start_datetime <= check_datetime <= end_datetime
247
- MiniLogger.end(IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME, object={
244
+ logger.end(IS_DATETIME_IN_DATETIME_RANGE_METHOD_NAME, object={
248
245
  "is_datetime_in_datetime_range_result": is_datetime_in_datetime_range_result})
249
246
  return is_datetime_in_datetime_range_result
250
247
 
@@ -277,13 +274,13 @@ def create_http_body(body):
277
274
 
278
275
 
279
276
  def get_brand_name():
280
- validate_brand_name()
281
- return BRAND_NAME
277
+ return our_get_env("BRAND_NAME")
282
278
 
283
279
 
284
280
  def get_environment_name():
285
- validate_environment_name()
286
- return ENVIRONMENT_NAME
281
+ environment_name = our_get_env("ENVIRONMENT_NAME")
282
+ EnvironmentName(environment_name) # if invalid, raises ValueError: x is not a valid EnvironmentName
283
+ return environment_name
287
284
 
288
285
 
289
286
  def our_get_env(key: str, default: str = None, raise_if_not_found: bool = True) -> str:
@@ -302,4 +299,4 @@ def get_sql_username() -> str:
302
299
 
303
300
 
304
301
  def get_sql_password() -> str:
305
- return our_get_env("RDS_PASSWORD")
302
+ return our_get_env("RDS_PASSWORD")
@@ -0,0 +1,4 @@
1
+ # Later we'll generate this file using Sql2Code (from json_version database schema)
2
+ valid_json_versions = {
3
+ "240109": "Description"
4
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-remote
3
- Version: 0.0.71
3
+ Version: 0.0.72
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles-zone/python-sdk-remote-python-package
6
6
  Author: Circles
@@ -10,5 +10,6 @@ Classifier: License :: Other/Proprietary License
10
10
  Classifier: Operating System :: OS Independent
11
11
  Description-Content-Type: text/markdown
12
12
  Requires-Dist: python-dotenv
13
+ Requires-Dist: url-remote
13
14
 
14
15
  This is a package for sharing common functions used in different repositories
@@ -7,10 +7,9 @@ python_sdk_remote.egg-info/dependency_links.txt
7
7
  python_sdk_remote.egg-info/requires.txt
8
8
  python_sdk_remote.egg-info/top_level.txt
9
9
  python_sdk_remote/src/__init__.py
10
- python_sdk_remote/src/constants.py
11
10
  python_sdk_remote/src/item.py
12
11
  python_sdk_remote/src/mini_logger.py
13
12
  python_sdk_remote/src/our_object.py
14
13
  python_sdk_remote/src/unified_json.py
15
14
  python_sdk_remote/src/utilities.py
16
- python_sdk_remote/src/validate_environment.py
15
+ python_sdk_remote/src/valid_json_versions.py
@@ -7,7 +7,7 @@ package_dir = PACKAGE_NAME.replace("-", "_")
7
7
  # python -m build needs pyproject.toml or setup.py
8
8
  setuptools.setup(
9
9
  name=PACKAGE_NAME,
10
- version='0.0.71', # https://pypi.org/project/python-sdk-remote/
10
+ version='0.0.72', # https://pypi.org/project/python-sdk-remote/
11
11
  author="Circles",
12
12
  author_email="info@circles.life",
13
13
  description="PyPI Package for Circles Python SDK Local Python",
@@ -23,6 +23,7 @@ setuptools.setup(
23
23
  "Operating System :: OS Independent",
24
24
  ],
25
25
  install_requires=[
26
- "python-dotenv"
26
+ "python-dotenv",
27
+ "url-remote"
27
28
  ]
28
- )
29
+ )
@@ -1,12 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=61.0"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [tool.poetry]
6
- name = "python-sdk-local"
7
- version = "0.0.71" # https://pypi.org/project/python-sdk-local
8
- description = "python-sdk-local Python Package"
9
- readme = "README.md"
10
- authors = [
11
- "Circlez.ai <info@circlez.ai>",
12
- ]
@@ -1,20 +0,0 @@
1
- import os
2
-
3
- PYTHON_SDK_LOCAL_COMPONENT_ID = 184
4
- PYTHON_SDK_LOCAL_COMPONENT_NAME = 'python_sdk_local'
5
-
6
- ENVIRONMENT_NAME = os.getenv("ENVIRONMENT_NAME")
7
- BRAND_NAME = os.getenv("BRAND_NAME")
8
- LOGZIO_TOKEN = os.getenv("LOGZIO_TOKEN")
9
- # TODO Shall Can we use python-sdk function to get the value from Environment?
10
- # TODO Shall we get the value from environment here of send the value to the function as @akiva-skolnik did?
11
- GOOGLE_PORT_FOR_AUTHENTICATION = os.getenv("PORT_FOR_AUTHENTICATION")
12
-
13
- # dummy jwt for testing
14
- TEST_USER_JWT = (
15
- 'eyJhbGciObJIUzI1NiIsImR5cCI4DkpXWCJ9.'
16
- 'eyJlbWFpbCI6ImR1bW15QGVtYWlsLmNvbSIsInVzZXJJZCI'
17
- '6IjEyMzQ1Njc4IiwicHJvZmlsZUlkIjoiMTIzNDU2NzgiLCJy'
18
- 'b2xlcyI6WyJVU0VSIl0sImlhdCI6MTYxNTI0ODQ2MSwiZXhwIjoxNjE1MjUyMDYxfQ.'
19
- 'SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
20
- )
@@ -1,13 +0,0 @@
1
- class UnifiedJson:
2
- def __init__(self, data: dict, version: str):
3
- self.version = version
4
- self.data = data
5
-
6
- def get_unified_json(self):
7
- return {"version": self.version, "data": self.data}
8
-
9
- def __str__(self):
10
- return self.get_unified_json()
11
-
12
- def __repr__(self):
13
- return self.__str__()
@@ -1,42 +0,0 @@
1
- from .constants import BRAND_NAME, ENVIRONMENT_NAME, LOGZIO_TOKEN, GOOGLE_PORT_FOR_AUTHENTICATION
2
-
3
-
4
- # TODO Align with https://github.com/circles-zone/typescript-sdk-remote-typescript-package/edit/dev/typescript-sdk/src/utils/index.ts validateTenantEnvironmentVariables() # noqa501
5
- def validate_enviroment_variables():
6
- validate_brand_name()
7
- validate_environment_name()
8
- # if(os.getenv("PRODUCT_USER_IDENTIFIER") is None):
9
- # raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called "
10
- # "PRODUCT_USER_IDENTIFIER (instead of PRODUCT_USERNAME)")
11
- # removed by Idan because it dont has to be in every project
12
- #TODO Shall we push those commented lines of code to the repo?
13
- # if(os.getenv("PRODUCT_PASSWORD") is None):
14
- # raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called PRODUCT_PASSWORD")
15
- validate_logzio_token()
16
- validate_google_port_for_authentication()
17
-
18
-
19
- def validate_environment_name():
20
- if ENVIRONMENT_NAME is None:
21
- raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called "
22
- "ENVIRONMENT_NAME=local or play1 (instead of ENVIRONMENT)")
23
-
24
-
25
- def validate_brand_name():
26
- if BRAND_NAME is None:
27
- raise Exception(
28
- "logger-local-python-package LoggerLocal.py please add Environment Variable called BRAND_NAME=Circlez")
29
-
30
-
31
- def validate_logzio_token():
32
- if LOGZIO_TOKEN is None:
33
- raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called"
34
- " LOGZIO_TOKEN=cXNHuVkkffkilnkKzZlWExECRlSKqopE")
35
-
36
-
37
- def validate_google_port_for_authentication():
38
- if GOOGLE_PORT_FOR_AUTHENTICATION is None:
39
- # The port is 54219 because the authentication url is http://localhost:54219/
40
- raise Exception("please add Environment Variable"
41
- " PORT_FOR_AUTHENTICATION=54219 because"
42
- " the authentication url is http://localhost:54219/")