Skip to content

Fails when tokenExpires date is null #12

@the6thBook

Description

@the6thBook

On login, if tokenExpires is null DDPClient produces a TypeError and doesn't execute the callback

{"msg":"result","id":"1","result":{"id":"SOME-ID","token":"SOME-TOKEN","tokenExpires":{"$date":null},"type":"resume"}}
Exception in thread <<<{"msg": "connect", "version": "1", "support": ["1", "pre2", "pre1"], "session": "qfNH8MtjGqqhkG5qs"}

WebSocketClient:
Traceback (most recent call last):
File "/var/lang/lib/python3.9/threading.py", line 980, in _bootstrap_inner

{"server_id":"0"}
{"msg":"connected","session":"SOME=SESSION"}

  • RECONNECTED
    self.run()
    File "/var/lang/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
    File "/opt/python/ws4py/websocket.py", line 528, in run
    if not self.once():
    File "/opt/python/DDPClient.py", line 53, in once
    return super(DDPSocket, self).once()
    File "/opt/python/ws4py/websocket.py", line 410, in once
    if not self.process(self.buf[:requested]):
    File "/opt/python/ws4py/websocket.py", line 480, in process
    self.received_message(s.message)
    File "/opt/python/DDPClient.py", line 41, in received_message
    self.emit('received_message', data)
    File "/opt/python/pyee/base.py", line 176, in emit
    handled = self._call_handlers(event, args, kwargs)
    File "/opt/python/pyee/base.py", line 154, in _call_handlers
    self._emit_run(f, args, kwargs)
    File "/opt/python/pyee/base.py", line 130, in _emit_run
    f(*args, **kwargs)
    File "/opt/python/DDPClient.py", line 162, in received_message
    data = ejson.loads(str(data))
    File "/opt/python/ejson/init.py", line 132, in loads
    return json.loads(obj, *args, cls=kwargs.pop('cls', EJSONDecoder), **kwargs)
    File "/var/lang/lib/python3.9/json/init.py", line 359, in loads
    return cls(**kw).decode(s)
    File "/opt/python/ejson/init.py", line 126, in decode
    return self._decode(o)
    File "/opt/python/ejson/init.py", line 117, in _decode
    return {k: self._decode(v) for k, v in o.items()}
    File "/opt/python/ejson/init.py", line 117, in
    return {k: self._decode(v) for k, v in o.items()}
    File "/opt/python/ejson/init.py", line 117, in _decode
    return {k: self._decode(v) for k, v in o.items()}
    File "/opt/python/ejson/init.py", line 117, in
    return {k: self._decode(v) for k, v in o.items()}
    File "/opt/python/ejson/init.py", line 104, in _decode
    return datetime.fromtimestamp(o["$date"] / 1000.0, timezone.utc)
    TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions