python-sdk-remote 0.0.144__py3-none-any.whl → 0.0.145__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.
- python_sdk_remote/our_object.py +22 -2
- {python_sdk_remote-0.0.144.dist-info → python_sdk_remote-0.0.145.dist-info}/METADATA +1 -1
- {python_sdk_remote-0.0.144.dist-info → python_sdk_remote-0.0.145.dist-info}/RECORD +5 -5
- {python_sdk_remote-0.0.144.dist-info → python_sdk_remote-0.0.145.dist-info}/WHEEL +0 -0
- {python_sdk_remote-0.0.144.dist-info → python_sdk_remote-0.0.145.dist-info}/top_level.txt +0 -0
python_sdk_remote/our_object.py
CHANGED
|
@@ -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
|
|
|
@@ -77,10 +78,29 @@ class OurObject(ABC):
|
|
|
77
78
|
return get_all_arguments_result
|
|
78
79
|
|
|
79
80
|
def to_json(self) -> str:
|
|
80
|
-
"""
|
|
81
|
-
to_json_result =
|
|
81
|
+
"""This is backwards compatible with the previous implementation"""
|
|
82
|
+
to_json_result = self.to_json_str()
|
|
82
83
|
return to_json_result
|
|
83
84
|
|
|
85
|
+
def to_json_dict(self) -> str:
|
|
86
|
+
"""Returns a json string representation of this object"""
|
|
87
|
+
json_str = self.to_json_str()
|
|
88
|
+
json_dict = json.loads(json_str)
|
|
89
|
+
|
|
90
|
+
return json_dict
|
|
91
|
+
|
|
92
|
+
def to_json_str(self) -> str:
|
|
93
|
+
"""Returns a json string representation of this object"""
|
|
94
|
+
to_json_str_result = json.dumps(self.__dict__, default=self._serialize)
|
|
95
|
+
return to_json_str_result
|
|
96
|
+
|
|
97
|
+
@staticmethod
|
|
98
|
+
def _serialize(obj):
|
|
99
|
+
"""Custom serialization function for unsupported types. Used by json.dumps"""
|
|
100
|
+
if isinstance(obj, datetime):
|
|
101
|
+
return obj.isoformat() # Converts datetime to ISO 8601 string
|
|
102
|
+
raise TypeError(f"Type {type(obj)} not serializable")
|
|
103
|
+
|
|
84
104
|
def from_json(self, json_string: str) -> 'OurObject':
|
|
85
105
|
"""Returns an instance of the class from a json string"""
|
|
86
106
|
FROM_JSON_METHOD_NAME = 'from_json'
|
|
@@ -4,12 +4,12 @@ python_sdk_remote/http_response.py,sha256=eu8wF85zLqIuT5LhgCRb4fnYP5T91R92qJmejX
|
|
|
4
4
|
python_sdk_remote/is_test_data.py,sha256=zbUz-Juj7vOPG9TtIttMIBWFxbsOs4-TuR1RYfGNkp4,92
|
|
5
5
|
python_sdk_remote/item.py,sha256=6DQs1nBKbEmnHjE50vZtkMr14ECS_9b8cvE7ItPAbhE,322
|
|
6
6
|
python_sdk_remote/mini_logger.py,sha256=vzkrSSebDWbrgWlO1QyLuB-IJ4mIgvBxlxOMKQgAi1Y,4232
|
|
7
|
-
python_sdk_remote/our_object.py,sha256=
|
|
7
|
+
python_sdk_remote/our_object.py,sha256=Db3_CbM4e1VtDU97VDesnBNMXNuYvnuDL7QqHv4MgJo,4618
|
|
8
8
|
python_sdk_remote/unified_json.py,sha256=zk4Lo9t9MSHXW8UKdo50YCYmFv5FgTsmHf6l2AWqLWU,961
|
|
9
9
|
python_sdk_remote/utilities.py,sha256=JB_LQoRGDlNktbr4twg1CAGSus7d2NC_Npcpl-WR0Eo,15861
|
|
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.
|
|
13
|
-
python_sdk_remote-0.0.
|
|
14
|
-
python_sdk_remote-0.0.
|
|
15
|
-
python_sdk_remote-0.0.
|
|
12
|
+
python_sdk_remote-0.0.145.dist-info/METADATA,sha256=OcPX_fOGobxPy9Mp_UMTW9sVgUK24k3YIqhpSPQNJTU,729
|
|
13
|
+
python_sdk_remote-0.0.145.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
python_sdk_remote-0.0.145.dist-info/top_level.txt,sha256=JTpEq_svPlI5hTlPq30Ne-NkR-u5464gjVDP2U74PvE,18
|
|
15
|
+
python_sdk_remote-0.0.145.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|