python-sdk-local 0.0.50__tar.gz → 0.0.51__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
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-local
3
- Version: 0.0.50
3
+ Version: 0.0.51
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles
6
6
  Author: Circles
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-local
3
- Version: 0.0.50
3
+ Version: 0.0.51
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles
6
6
  Author: Circles
@@ -1,3 +1,5 @@
1
+ from datetime import time, datetime, timedelta, date
2
+ from dotenv import load_dotenv
1
3
  import sys
2
4
  import os
3
5
  from urllib.parse import urlparse
@@ -5,8 +7,6 @@ import json
5
7
  script_directory = os.path.dirname(os.path.abspath(__file__))
6
8
  sys.path.append(os.path.join(script_directory, '..'))
7
9
 
8
- from dotenv import load_dotenv
9
- from datetime import time, datetime, timedelta, date
10
10
  from .constants import * # noqa: E402¸
11
11
  load_dotenv()
12
12
  from logger_local.Logger import Logger # noqa: E402
@@ -77,14 +77,18 @@ def is_valid_time_range(time_range: tuple) -> bool:
77
77
  logger.end(IS_VALID_TIME_RANGE_METHOD_NAME, object={
78
78
  "is_valid_time_range_result": True})
79
79
  return True
80
+
81
+
80
82
  def validate_url(url):
81
- if url is not None or url !="":
83
+ if url is not None or url != "":
82
84
  parsed_url = urlparse(url)
83
85
  return parsed_url.scheme and parsed_url.netloc
84
86
  return True
87
+
88
+
85
89
  def create_http_body(body):
86
90
  return json.dumps(body)
87
-
91
+
88
92
 
89
93
  def is_valid_date_range(date_range: tuple) -> bool:
90
94
  """
@@ -251,13 +255,50 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: tupl
251
255
 
252
256
 
253
257
  def create_http_headers(jwt_token: str):
254
- http_header = {
258
+ http_header = {
255
259
  'Content-Type': 'application/json',
256
260
  'Authorization': f'Bearer {jwt_token}',
257
261
  }
258
- return http_header
262
+ return http_header
263
+
264
+
259
265
  def create_return_http_headers():
260
266
  return {
261
- "Content-Type": "application/json",
262
- "Access-Control-Allow-Origin": "*",
263
- }
267
+ "Content-Type": "application/json",
268
+ "Access-Control-Allow-Origin": "*",
269
+ }
270
+
271
+
272
+ def get_display_name(first_name: str, last_name: str = None, organization: str = None) -> str:
273
+ """
274
+ Get the display name for a user.
275
+
276
+ Parameters:
277
+ first_name (str): The first name of the user.
278
+ last_name (str): The last name of the user.
279
+ organization (str): The organization of the user.
280
+
281
+ Returns:
282
+ str: The display name of the user.
283
+
284
+ Example:
285
+ Usage of get_display_name:
286
+
287
+ >>> first_name = 'John'
288
+ >>> last_name = 'Doe'
289
+ >>> organization = 'ABC'
290
+ >>> display_name = get_display_name(first_name, last_name, organization)
291
+ >>> print(display_name)
292
+ 'John Doe (ABC)'
293
+ """
294
+ GET_DISPLAY_NAME_METHOD_NAME = "get_display_name"
295
+ logger.start(GET_DISPLAY_NAME_METHOD_NAME, object={
296
+ "first_name": first_name, "last_name": last_name, "organization": organization})
297
+ display_name = first_name
298
+ if last_name is not None:
299
+ display_name += f" {last_name}"
300
+ if organization is not None:
301
+ display_name += f" ({organization})"
302
+ logger.end(GET_DISPLAY_NAME_METHOD_NAME, object={
303
+ "display_name": display_name})
304
+ return display_name
@@ -0,0 +1,18 @@
1
+ import os
2
+
3
+
4
+ def validate_enviroment_variables():
5
+ if (os.getenv("ENVIRONMENT_NAME") is None):
6
+ raise Exception(
7
+ "logger-local-python-package LoggerLocal.py please add Environment Variable called ENVIRONMENT_NAME=local or play1 (instead of ENVIRONMENT)")
8
+ if (os.getenv("BRAND_NAME") is None):
9
+ raise Exception(
10
+ "logger-local-python-package LoggerLocal.py please add Environment Variable called BRAND_NAME=Circlez")
11
+ # if(os.getenv("PRODUCT_USER_IDENTIFIER") is None):
12
+ # raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called PRODUCT_USER_IDENTIFIER (instead of PRODUCT_USERNAME)")
13
+ # removed by Idan because it dont has to be in every project
14
+ # if(os.getenv("PRODUCT_PASSWORD") is None):
15
+ # raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called PRODUCT_PASSWORD")
16
+ if (os.getenv("LOGZIO_TOKEN") is None):
17
+ raise Exception(
18
+ "logger-local-python-package LoggerLocal.py please add Environment Variable called LOGZIO_TOKEN=cXNHuVkkffkilnkKzZlWExECRlSKqopE")
@@ -3,7 +3,7 @@ import setuptools
3
3
  # python -m build needs pyproject.toml or setup.py
4
4
  setuptools.setup(
5
5
  name='python-sdk-local',
6
- version='0.0.50', # https://pypi.org/project/python-sdk-local/
6
+ version='0.0.51', # https://pypi.org/project/python-sdk-local/
7
7
  author="Circles",
8
8
  author_email="info@circles.life",
9
9
  description="PyPI Package for Circles Python SDK Local Python",
@@ -1,16 +0,0 @@
1
- import os
2
-
3
- def validate_enviroment_variables():
4
- if(os.getenv("ENVIRONMENT_NAME") is None):
5
- raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called ENVIRONMENT_NAME=local or play1 (instead of ENVIRONMENT)")
6
- if(os.getenv("BRAND_NAME") is None):
7
- raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called BRAND_NAME=Circlez")
8
- # if(os.getenv("PRODUCT_USER_IDENTIFIER") is None):
9
- # raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called PRODUCT_USER_IDENTIFIER (instead of PRODUCT_USERNAME)")
10
- #removed by Idan because it dont has to be in every project
11
- # if(os.getenv("PRODUCT_PASSWORD") is None):
12
- # raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called PRODUCT_PASSWORD")
13
- if(os.getenv("LOGZIO_TOKEN") is None):
14
- raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called LOGZIO_TOKEN=cXNHuVkkffkilnkKzZlWExECRlSKqopE")
15
-
16
-