Hi,
What is the usecase ?
-
Download sheet from smartsheet services using smartsheet-python-sdk client
-
Serialize object to store it in NoSQL database
-
Fetch object from database and deserialize it to smartsheet.models.Sheet object
Sample code presenting scenario above:
client = smartsheet.Smartsheet('some_token')
sheet = client.Sheets.get_sheet(123123123)
id = database.insert(sheet.to_dict())
raw_object = database.get(id)
deserialized = client.models.Sheet(raw_object)
What is the problem ?
When deserializing object I get following errors:
- date parsing errors:
dateutil.parser._parser.ParserError: Unknown string format: 2020-12-18T10:43:24+00:00Z
Sample code to reproduce problem:
from smartsheet import smartsheet
sheet = smartsheet.models.Sheet({'createdAt': '2000-01-02T03:04:05Z'})
serialized = sheet.to_dict()
smartsheet.models.Sheet(serialized)
- other errors
This one is related to Sight object internals. Fetching Sight from server works and object can be created, but after serializing this object (if has some internal problem with sheet reference) - it is not possible to reconstruct it during deserialization
model_1 | File "/usr/local/lib/python3.9/site-packages/smartsheet/models/widget.py", line 84, in contents
model_1 | widget_type = value['type']
model_1 | KeyError: 'type'
Serialized widget object content looks like that:
widgets": [{"error": {"code": 1170, "errorCode": 1170, "message": "The sheet referenced by this widget is unavailable or deleted.", "refId": "b6f3clf1h5n8"},...
Expected result
- It should be possible to deserialize smartsheet object from its serialized representation
Am I doing something wrong during serialization/deserialization process?
Thanks,
P.