aleph-im/pyaleph

The Websocket API returns dates as ISO strings, specs requires timestamps

Closed this issue · 1 comments

hoh commented

When fetching messages from the API in aleph-vm-supervisor, I get:

023-05-10 10:25:21,320 | DEBUG | Websocket connected on https://official.aleph.cloud/api/ws0/messages?startDate=1683707121
2023-05-10 10:25:21,386 | ERROR | Invalid Aleph message: 
  [
  {
    "loc": [
      "time"
    ],
    "msg": "value is not a valid float",
    "type": "type_error.float"
  }
]
  [ErrorWrapper(exc=FloatError(), loc=('time',))]
Traceback (most recent call last):
  File "/root/aleph-vm/vm_supervisor/tasks.py", line 66, in subscribe_via_ws
    yield Message(**data)
  File "/usr/local/lib/python3.9/dist-packages/aleph_message/models/__init__.py", line 328, in Message
    return message_class(**message_dict)
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for PostMessage
time
  value is not a valid float (type=type_error.float)

Fixed by #438.