python-sdk-remote 0.0.149__py3-none-any.whl → 0.0.150__py3-none-any.whl

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.
@@ -279,6 +279,21 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: (dat
279
279
  return is_datetime_in_datetime_range_result
280
280
 
281
281
 
282
+ # TODO add optional_prefix optional parameter. First check with optional_prefix, if not found, check without it.
283
+ def our_get_env(key: str, default: str = None, raise_if_not_found: bool = True,
284
+ raise_if_empty: bool = False) -> str:
285
+ logger.start(object={"key": key, "default": default,
286
+ "raise_if_not_found": raise_if_not_found,
287
+ "raise_if_empty": raise_if_empty})
288
+ env_var = os.getenv(key, default)
289
+ # TODO: "default is None" is always False
290
+ if ((raise_if_not_found and key not in os.environ and default is None)
291
+ or (raise_if_empty and not env_var and not default)):
292
+ raise Exception(f"Environment variable {key} not found - please check your .env file") # noqa: E501
293
+ logger.end(object={"env_var": env_var})
294
+ return env_var
295
+
296
+
282
297
  def get_brand_name(raise_if_not_found: bool = True,
283
298
  raise_if_empty: bool = False) -> str:
284
299
  get_brand_name_result = our_get_env("BRAND_NAME",
@@ -296,19 +311,21 @@ def get_environment_name(raise_if_not_found: bool = True,
296
311
  return environment_name
297
312
 
298
313
 
299
- # TODO add optional_prefix optional parameter. First check with optional_prefix, if not found, check without it.
300
- def our_get_env(key: str, default: str = None, raise_if_not_found: bool = True,
301
- raise_if_empty: bool = False) -> str:
302
- logger.start(object={"key": key, "default": default,
303
- "raise_if_not_found": raise_if_not_found,
304
- "raise_if_empty": raise_if_empty})
305
- env_var = os.getenv(key, default)
306
- # TODO: "default is None" is always False
307
- if ((raise_if_not_found and key not in os.environ and default is None)
308
- or (raise_if_empty and not env_var and not default)):
309
- raise Exception(f"Environment variable {key} not found - please check your .env file") # noqa: E501
310
- logger.end(object={"env_var": env_var})
311
- return env_var
314
+ def get_product_user_identifier(raise_if_not_found: bool = True,
315
+ raise_if_empty: bool = False) -> str:
316
+ get_product_user_identifier_result = our_get_env("PRODUCT_USER_IDENTIFIER",
317
+ raise_if_not_found=raise_if_not_found, # noqa E501
318
+ raise_if_empty=raise_if_empty) # noqa E501
319
+ return get_product_user_identifier_result
320
+
321
+
322
+ def get_product_user_password(raise_if_not_found: bool = True,
323
+ raise_if_empty: bool = False) -> str:
324
+ # TODO Add support to PRODUCT_USER_PASSWORD and deprecation message for PRODUCT_PASSWORD (backward compatible)
325
+ get_product_user_password_result = our_get_env("PRODUCT_PASSWORD",
326
+ raise_if_not_found=raise_if_not_found, # noqa E501
327
+ raise_if_empty=raise_if_empty) # noqa E501
328
+ return get_product_user_password_result
312
329
 
313
330
 
314
331
  # TODO As only the database package uses those, let's move those three to the database package # noqa: E501
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sdk-remote
3
- Version: 0.0.149
3
+ Version: 0.0.150
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
@@ -6,10 +6,10 @@ python_sdk_remote/item.py,sha256=6DQs1nBKbEmnHjE50vZtkMr14ECS_9b8cvE7ItPAbhE,322
6
6
  python_sdk_remote/mini_logger.py,sha256=EAARhRUvUTQKeSJLDS5n9AxNra9Jk0DUyFsAMhX0wCs,4869
7
7
  python_sdk_remote/our_object.py,sha256=Db3_CbM4e1VtDU97VDesnBNMXNuYvnuDL7QqHv4MgJo,4618
8
8
  python_sdk_remote/unified_json.py,sha256=zk4Lo9t9MSHXW8UKdo50YCYmFv5FgTsmHf6l2AWqLWU,961
9
- python_sdk_remote/utilities.py,sha256=o-QyI5BnXmSmLbnJX3oJ-4yy5ltQxGKEVNmhHmV3E_8,17042
9
+ python_sdk_remote/utilities.py,sha256=MVWbVkuWQNywumh-7Sw1cLy3Fiq7EMtJiYzJ0HclRzw,18072
10
10
  python_sdk_remote/valid_json_versions.py,sha256=-ZU65JYI6gTEfK8o6gu9Dmm9SQmwzj5pDbEXiyUbBhQ,138
11
11
  python_sdk_remote/validate_environment.py,sha256=nzCHZDw56G56ekrTQT3gG48utjsU4VCwQi9dVsBDas0,2268
12
- python_sdk_remote-0.0.149.dist-info/METADATA,sha256=3GIleuiSvYJxv__8RQrkaY_XYqfztqR3XRXfIDvnKG8,729
13
- python_sdk_remote-0.0.149.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- python_sdk_remote-0.0.149.dist-info/top_level.txt,sha256=JTpEq_svPlI5hTlPq30Ne-NkR-u5464gjVDP2U74PvE,18
15
- python_sdk_remote-0.0.149.dist-info/RECORD,,
12
+ python_sdk_remote-0.0.150.dist-info/METADATA,sha256=dtgAcLP89567n7fieDu8GWgxXB3fHwyNkIKK6t8yXhI,729
13
+ python_sdk_remote-0.0.150.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ python_sdk_remote-0.0.150.dist-info/top_level.txt,sha256=JTpEq_svPlI5hTlPq30Ne-NkR-u5464gjVDP2U74PvE,18
15
+ python_sdk_remote-0.0.150.dist-info/RECORD,,