python-sdk-remote 0.0.134__py3-none-any.whl → 0.0.136__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.
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  from abc import ABC # , abstractmethod
3
+ from datetime import datetime
3
4
 
4
5
  from .mini_logger import MiniLogger as logger
5
6
 
@@ -44,8 +45,26 @@ class OurObject(ABC):
44
45
  return self.__dict__
45
46
 
46
47
  def to_json(self) -> str:
48
+ """This is backwards compatible with the previous implementation"""
49
+ return self.to_json_str()
50
+
51
+ def to_json_dict(self) -> str:
47
52
  """Returns a json string representation of this object"""
48
- return json.dumps(self.__dict__)
53
+ json_str = self.to_json_str()
54
+ json_dict = json.loads(json_str)
55
+
56
+ return json_dict
57
+
58
+ def to_json_str(self) -> str:
59
+ """Returns a json string representation of this object"""
60
+ return json.dumps(self.__dict__, default=self._serialize)
61
+
62
+ @staticmethod
63
+ def _serialize(obj):
64
+ """Custom serialization function for unsupported types. Used by json.dumps"""
65
+ if isinstance(obj, datetime):
66
+ return obj.isoformat() # Converts datetime to ISO 8601 string
67
+ raise TypeError(f"Type {type(obj)} not serializable")
49
68
 
50
69
  def from_json(self, json_string: str) -> 'OurObject':
51
70
  """Returns an instance of the class from a json string"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-sdk-remote
3
- Version: 0.0.134
3
+ Version: 0.0.136
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
@@ -3,12 +3,12 @@ python_sdk_remote/constants.py,sha256=0bg3t_4wzZLWFapseENer7qSx3NvniEF5n0H8AZ2G3
3
3
  python_sdk_remote/http_response.py,sha256=8-xkwl9LyuVh4F1cc5sFZBo0cj1LkOkJOluEWnsJQLY,6071
4
4
  python_sdk_remote/item.py,sha256=HnSLHkZTKTLNhlaZoPhKAwqG-yHPsd7zvqPPOqnrKVg,287
5
5
  python_sdk_remote/mini_logger.py,sha256=E6OUZ39uBkPN_cjemO6hfJcRcYtP1xh1ZwaCFyZYsXA,4132
6
- python_sdk_remote/our_object.py,sha256=zlBKxctwNKYPK2uVMNz-Cx7_efF1O_1gZksZHcFTBBw,2621
6
+ python_sdk_remote/our_object.py,sha256=rz_IhpZspqo2Wp-OesDgVdfQQNIYLEpkP3_bkvK7ArY,3333
7
7
  python_sdk_remote/unified_json.py,sha256=tLkikIVpFAtpioYwtovkGX8-3U9YElGWe4Ph34qDTq4,837
8
8
  python_sdk_remote/utilities.py,sha256=O02QqYqN-s3AZ3OC3-oYHOljZQgEA32Kcl-YzBs02DA,15100
9
9
  python_sdk_remote/valid_json_versions.py,sha256=-ZU65JYI6gTEfK8o6gu9Dmm9SQmwzj5pDbEXiyUbBhQ,138
10
10
  python_sdk_remote/validate_environment.py,sha256=nzCHZDw56G56ekrTQT3gG48utjsU4VCwQi9dVsBDas0,2268
11
- python_sdk_remote-0.0.134.dist-info/METADATA,sha256=xAVz0kg6PTdsHWRDwM3jD7W_RhT4UfzVCY7FoLHh8So,778
12
- python_sdk_remote-0.0.134.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
13
- python_sdk_remote-0.0.134.dist-info/top_level.txt,sha256=JTpEq_svPlI5hTlPq30Ne-NkR-u5464gjVDP2U74PvE,18
14
- python_sdk_remote-0.0.134.dist-info/RECORD,,
11
+ python_sdk_remote-0.0.136.dist-info/METADATA,sha256=Oy7Nmvm9PbFYo9lPp8EPtYbhRT9M959iOwmOnwlF9bM,778
12
+ python_sdk_remote-0.0.136.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
13
+ python_sdk_remote-0.0.136.dist-info/top_level.txt,sha256=JTpEq_svPlI5hTlPq30Ne-NkR-u5464gjVDP2U74PvE,18
14
+ python_sdk_remote-0.0.136.dist-info/RECORD,,