Datetime serialisation in RPC client

Ok I’m sure I’m missing something simple here and I’ve tried searching but I had assumed that using the RPC proxy that it would just deal with datetime.datetime()

My jaw is starting to get sore from the rage :wink:

I get that RPC is probably just dealing with standard types but I really need to make this work and I’m lost.

The default RPC serialiser is JSON, which doesn’t have a datetime type.

You have a few options:

  1. Don’t send datetime objects over the wire. It’s common to isoformat() them to strings first.
  2. Change the default serializer to something that does handle datetimes. pickle is supported out of the box, and yaml too if you install pyyaml.
  3. Implement a custom serializer that knows how to handle datetimes. The interface for this isn’t brilliant, but there are plenty of examples on the forum
1 Like