python-sdk-remote 0.0.134__py3-none-any.whl → 0.0.135__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
 
@@ -45,7 +46,14 @@ class OurObject(ABC):
45
46
 
46
47
  def to_json(self) -> str:
47
48
  """Returns a json string representation of this object"""
48
- return json.dumps(self.__dict__)
49
+ return json.dumps(self.__dict__, default=self._serialize)
50
+
51
+ @staticmethod
52
+ def _serialize(obj):
53
+ """Custom serialization function for unsupported types. Used by json.dumps"""
54
+ if isinstance(obj, datetime):
55
+ return obj.isoformat() # Converts datetime to ISO 8601 string
56
+ raise TypeError(f"Type {type(obj)} not serializable")
49
57
 
50
58
  def from_json(self, json_string: str) -> 'OurObject':
51
59
  """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.135
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=T1Qs1DMeVsmCWv4vNXWzc2eT6GbmvrIX8JlODb7j3lI,2981
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.135.dist-info/METADATA,sha256=Autamnq1SOP7jdG5OXwgbAs83NZTxnj9jnBxGUIdlyE,778
12
+ python_sdk_remote-0.0.135.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
13
+ python_sdk_remote-0.0.135.dist-info/top_level.txt,sha256=JTpEq_svPlI5hTlPq30Ne-NkR-u5464gjVDP2U74PvE,18
14
+ python_sdk_remote-0.0.135.dist-info/RECORD,,