python-sdk-remote 0.0.51__tar.gz → 0.0.52__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 (18) hide show
  1. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/PKG-INFO +1 -1
  2. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote/src/item.py +0 -1
  3. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote/src/mini_logger.py +1 -1
  4. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote/src/our_object.py +1 -1
  5. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote/src/utilities.py +19 -8
  6. python-sdk-remote-0.0.52/python_sdk_remote/src/validate.py +33 -0
  7. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote.egg-info/PKG-INFO +1 -1
  8. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/setup.py +1 -1
  9. python-sdk-remote-0.0.51/python_sdk_remote/src/validate.py +0 -19
  10. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/README.md +0 -0
  11. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/pyproject.toml +0 -0
  12. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote/__init__.py +0 -0
  13. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote/src/__init__.py +0 -0
  14. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote/src/constants.py +0 -0
  15. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote.egg-info/SOURCES.txt +0 -0
  16. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
  17. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/python_sdk_remote.egg-info/top_level.txt +0 -0
  18. {python-sdk-remote-0.0.51 → python-sdk-remote-0.0.52}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-remote
3
- Version: 0.0.51
3
+ Version: 0.0.52
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles
6
6
  Author: Circles
@@ -10,4 +10,3 @@ class Item(OurObject):
10
10
  @abstractmethod
11
11
  def get_id(self):
12
12
  raise NotImplementedError("Subclasses must implement the 'get_id' method.")
13
-
@@ -60,7 +60,7 @@ class MiniLogger:
60
60
  print(f"{datetime.now()} - WARNING - {message}")
61
61
  else:
62
62
  print(f"{datetime.now()} - WARNING {message} - {str(object)}")
63
-
63
+
64
64
  @staticmethod
65
65
  def error(message: str = "", object: dict = None):
66
66
  """
@@ -4,7 +4,7 @@ import sys
4
4
  import os
5
5
  from dotenv import load_dotenv
6
6
  sys.path.append(os.getcwd())
7
- from .constants import * # noqa: E402
7
+ from .constants import OBJECT_TO_INSERT_CODE # noqa: E402
8
8
  load_dotenv()
9
9
  from logger_local.Logger import Logger # noqa: E402
10
10
  from abc import ABC, abstractmethod # noqa: E402
@@ -2,12 +2,13 @@ import sys
2
2
  import os
3
3
  from urllib.parse import urlparse
4
4
  import json
5
+ from dotenv import load_dotenv
6
+ from datetime import time, datetime, timedelta, date
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
- from .constants import * # noqa: E402¸
10
+ from .constants import OBJECT_TO_INSERT_CODE # noqa: E402
11
+ from .validate import validate_environment_name, validate_brand_name # noqa: E402
11
12
  load_dotenv()
12
13
  from logger_local.Logger import Logger # noqa: E402
13
14
 
@@ -80,7 +81,7 @@ def is_valid_time_range(time_range: tuple) -> bool:
80
81
 
81
82
 
82
83
  def validate_url(url):
83
- if url is not None or url !="":
84
+ if url is not None or url != "":
84
85
  parsed_url = urlparse(url)
85
86
  return parsed_url.scheme and parsed_url.netloc
86
87
  return True
@@ -250,13 +251,13 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: tupl
250
251
  return is_datetime_in_datetime_range_result
251
252
 
252
253
 
253
- # TODO Align those methods with typescript-sdk https://github.com/circles-zone/typescript-sdk-remote-typescript-package/blob/dev/typescript-sdk/src/utils/index.ts
254
+ # TODO Align those methods with typescript-sdk https://github.com/circles-zone/typescript-sdk-remote-typescript-package/blob/dev/typescript-sdk/src/utils/index.ts # noqa501
254
255
  # TODO Take those three functions to a separate file http_response.py
255
256
  # TODO Shall we create also createInternalServerErrorHttpResponse(), createOkHttpResponse() like we have in TypeScript?
256
257
 
257
258
  # Former name was create_http_headers()
258
259
  def create_authorization_http_headers(user_jwt: str):
259
- http_headers = {
260
+ http_headers = {
260
261
  'Content-Type': 'application/json',
261
262
  'Authorization': f'Bearer {user_jwt}',
262
263
  }
@@ -266,8 +267,8 @@ def create_authorization_http_headers(user_jwt: str):
266
267
  def create_return_http_headers():
267
268
  return {
268
269
  "Content-Type": "application/json",
269
- "Access-Control-Allow-Origin": "*",
270
- }
270
+ "Access-Control-Allow-Origin": "*",
271
+ }
271
272
 
272
273
 
273
274
  # https://google.github.io/styleguide/jsoncstyleguide.xml?showone=Property_Name_Format#Property_Name_Format
@@ -275,3 +276,13 @@ def create_http_body(body):
275
276
  # TODO console.warning() if the body is not a valid camelCase JSON
276
277
  # https://stackoverflow.com/questions/17156078/converting-identifier-naming-between-camelcase-and-underscores-during-json-seria
277
278
  return json.dumps(body)
279
+
280
+
281
+ def get_brand_name():
282
+ validate_brand_name()
283
+ return os.getenv("BRAND_NAME")
284
+
285
+
286
+ def get_environment_name():
287
+ validate_environment_name()
288
+ return os.getenv("ENVIRONMENT_NAME")
@@ -0,0 +1,33 @@
1
+ import os
2
+
3
+ # TODO Rename this file to validate_environment.py similar to what we have in TypeScript
4
+
5
+
6
+ # TODO Align with https://github.com/circles-zone/typescript-sdk-remote-typescript-package/edit/dev/typescript-sdk/src/utils/index.ts validateTenantEnvironmentVariables() # noqa501
7
+ def validate_enviroment_variables():
8
+ validate_brand_name()
9
+ validate_environment_name()
10
+ # if(os.getenv("PRODUCT_USER_IDENTIFIER") is None):
11
+ # raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called "
12
+ # "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
+ validate_logzio_token()
17
+
18
+
19
+ def validate_environment_name():
20
+ if (os.getenv("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 (os.getenv("BRAND_NAME") is None):
27
+ raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called BRAND_NAME=Circlez")
28
+
29
+
30
+ def validate_logzio_token():
31
+ if (os.getenv("LOGZIO_TOKEN") is None):
32
+ raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called"
33
+ " LOGZIO_TOKEN=cXNHuVkkffkilnkKzZlWExECRlSKqopE")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-remote
3
- Version: 0.0.51
3
+ Version: 0.0.52
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles
6
6
  Author: Circles
@@ -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-remote',
6
- version='0.0.51', # https://pypi.org/project/python-sdk-local/
6
+ version='0.0.52', # 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,19 +0,0 @@
1
- import os
2
-
3
- # TODO Rename this file to validate_environment.py similar to what we have in TypeScript
4
-
5
- # TODO Align with https://github.com/circles-zone/typescript-sdk-remote-typescript-package/edit/dev/typescript-sdk/src/utils/index.ts validateTenantEnvironmentVariables()
6
- def validate_enviroment_variables():
7
- if(os.getenv("ENVIRONMENT_NAME") is None):
8
- raise Exception("logger-local-python-package LoggerLocal.py please add Environment Variable called ENVIRONMENT_NAME=local or play1 (instead of ENVIRONMENT)")
9
- if(os.getenv("BRAND_NAME") is None):
10
- raise Exception("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("logger-local-python-package LoggerLocal.py please add Environment Variable called LOGZIO_TOKEN=cXNHuVkkffkilnkKzZlWExECRlSKqopE")
18
-
19
-