python-sdk-local 0.0.147__tar.gz → 0.0.148__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.
Files changed (20) hide show
  1. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/PKG-INFO +1 -1
  2. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/utilities.py +37 -10
  3. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local.egg-info/PKG-INFO +1 -1
  4. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/setup.py +1 -1
  5. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/README.md +0 -0
  6. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/pyproject.toml +0 -0
  7. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/__init__.py +0 -0
  8. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/constants.py +0 -0
  9. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/http_response.py +0 -0
  10. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/item.py +0 -0
  11. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/our_object.py +0 -0
  12. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/service_response.py +0 -0
  13. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/unified_json.py +0 -0
  14. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/valid_json_versions.py +0 -0
  15. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local/src/validate_environment.py +0 -0
  16. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local.egg-info/SOURCES.txt +0 -0
  17. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local.egg-info/dependency_links.txt +0 -0
  18. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local.egg-info/requires.txt +0 -0
  19. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/python_sdk_local.egg-info/top_level.txt +0 -0
  20. {python_sdk_local-0.0.147 → python_sdk_local-0.0.148}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sdk-local
3
- Version: 0.0.147
3
+ Version: 0.0.148
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles-zone/python-sdk-local-python-package
6
6
  Author: Circles
@@ -15,8 +15,10 @@ from python_sdk_remote.mini_logger import MiniLogger as logger
15
15
  load_dotenv()
16
16
  # If DOTENV_PATH is defined, load the environment variables from the specified file
17
17
  # If OVERRIDE_DOTENV is set to True, override the existing environment variables
18
- override = True if os.getenv("OVERRIDE_DOTENV", "").lower() in ("t", "true", "0") else False
19
- load_dotenv(dotenv_path=os.environ.get("DOTENV_PATH"), override=override) # add another .env file if needed
18
+ override = True if os.getenv("OVERRIDE_DOTENV", "").lower() in (
19
+ "t", "true", "0") else False
20
+ load_dotenv(dotenv_path=os.environ.get("DOTENV_PATH"),
21
+ override=override) # add another .env file if needed
20
22
 
21
23
  # raise Exception("Failed to load environment variables from .env file\n"
22
24
  # "Please check if the file exists, maybe you are not in the right venv?")
@@ -72,7 +74,8 @@ def timedelta_to_time_format(time_delta: timedelta) -> str:
72
74
  "02:30:45"
73
75
  """
74
76
  TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME = "timedelta_to_time_format"
75
- logger.start(TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME, object={'time_delta': time_delta})
77
+ logger.start(TIMEDELTA_TO_TIME_FORMAT_METHOD_NAME,
78
+ object={'time_delta': time_delta})
76
79
 
77
80
  # Calculate the total seconds and convert to HH:MM:SS format
78
81
  total_seconds = int(time_delta.total_seconds())
@@ -94,7 +97,8 @@ def is_valid_time_range(time_range: tuple) -> bool:
94
97
  """
95
98
  logger.start(object={"time_range": time_range.__str__()})
96
99
  if len(time_range) != 2:
97
- logger.end(object={"is_valid_time_range_result": False, "reason": "len(time_range) != 2"})
100
+ logger.end(object={"is_valid_time_range_result": False,
101
+ "reason": "len(time_range) != 2"})
98
102
  return False
99
103
 
100
104
  for time_obj in time_range:
@@ -131,7 +135,8 @@ def is_valid_date_range(date_range: tuple) -> bool:
131
135
  """
132
136
  logger.start(object={"date_range": date_range.__str__()})
133
137
  if len(date_range) != 2:
134
- logger.end(object={"is_valid_date_range_result": False, "reason": "len(date_range) != 2"})
138
+ logger.end(object={"is_valid_date_range_result": False,
139
+ "reason": "len(date_range) != 2"})
135
140
  return False
136
141
 
137
142
  for date_obj in date_range:
@@ -149,7 +154,8 @@ def is_valid_datetime_range(datetime_range: tuple[datetime, datetime]) -> bool:
149
154
  """
150
155
  logger.start(object={"datetime_range": datetime_range.__str__()})
151
156
  if len(datetime_range) != 2:
152
- logger.end(object={"is_valid_datetime_range_result": False, "reason": "len(datetime_range) != 2"})
157
+ logger.end(object={"is_valid_datetime_range_result": False,
158
+ "reason": "len(datetime_range) != 2"})
153
159
  return False
154
160
 
155
161
  if not all(isinstance(datetime_obj, datetime) for datetime_obj in datetime_range):
@@ -186,7 +192,8 @@ def is_list_of_dicts(obj: object) -> bool:
186
192
  try:
187
193
  if not isinstance(obj, list):
188
194
  is_list_of_dicts_result = False
189
- logger.end(object={"is_list_of_dicts_result": is_list_of_dicts_result})
195
+ logger.end(
196
+ object={"is_list_of_dicts_result": is_list_of_dicts_result})
190
197
  return is_list_of_dicts_result
191
198
  for item in obj:
192
199
  if not isinstance(item, dict):
@@ -324,7 +331,8 @@ def validate_arguments(args: dict) -> None:
324
331
  """
325
332
  for arg, value in args.items():
326
333
  if not arg:
327
- raise ValueError(f"Argument {arg} is cannot be empty (got {value})")
334
+ raise ValueError(
335
+ f"Argument {arg} is cannot be empty (got {value})")
328
336
 
329
337
 
330
338
  def reformat_time_string(input_str: str) -> str:
@@ -342,12 +350,31 @@ def reformat_time_string(input_str: str) -> str:
342
350
 
343
351
  @lru_cache(maxsize=1)
344
352
  def get_ip_v4():
345
- return requests.get('https://ipv4.seeip.org/jsonip').json()['ip']
353
+ # Switched from ipv4.seeip.org to api.ipify.org to avoid SSL handshake issues with OpenSSL 3 in subprocess/multiprocessing environments.
354
+ # return requests.get('https://ipv4.seeip.org/jsonip').json()['ip']
355
+ default_ipv4 = "127.0.0.1"
356
+ try:
357
+ response = requests.get('https://api.ipify.org?format=json').json()
358
+ ipv4_address = response.get('ip', default_ipv4)
359
+ return ipv4_address
360
+ except requests.exceptions.SSLError:
361
+ logger.error("SSL Error while fetching IPv4 address. "
362
+ f"Defaulting to{default_ipv4}")
363
+ return default_ipv4
346
364
 
347
365
 
348
366
  @lru_cache(maxsize=1)
349
367
  def get_ip_v6():
350
- return requests.get('https://api.seeip.org/jsonip').json()['ip']
368
+ # return requests.get('https://api.seeip.org/jsonip').json()['ip']
369
+ default_ipv6 = "::1"
370
+ try:
371
+ response = requests.get('https://api64.ipify.org?format=json').json()
372
+ ipv6_address = response.get('ip', default_ipv6)
373
+ return ipv6_address
374
+ except requests.exceptions.SSLError:
375
+ logger.error("SSL Error while fetching IPv6 address. "
376
+ f"Defaulting to {default_ipv6}")
377
+ return default_ipv6
351
378
 
352
379
 
353
380
  def snake_to_camel(snake_str: str) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sdk-local
3
- Version: 0.0.147
3
+ Version: 0.0.148
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles-zone/python-sdk-local-python-package
6
6
  Author: Circles
@@ -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.147', # https://pypi.org/project/python-sdk-local/
10
+ version='0.0.148', # https://pypi.org/project/python-sdk-local/
11
11
  author="Circles",
12
12
  author_email="info@circlez.ai",
13
13
  description="PyPI Package for Circles Python SDK Local Python",