pronotepy icon indicating copy to clipboard operation
pronotepy copied to clipboard

Add json serialization

Open bdbogjoe opened this issue 2 years ago • 2 comments

I would like to create rest service using this lib to get data from pronote. Idea is to provide one endpoint per method, but i need to serialize object in json.

I want to create one docker accessing to pronote, and using this service from nodered to push data to mqtt and then homeassistant Unfortunately, i don't know anything about python to create such PR to provide serialization of object to json, would it be possible to add this ?

Regards, Eric

bdbogjoe avatar Sep 27 '22 10:09 bdbogjoe

I've been thinking about adding serialization to dict for some time now. I we could use the __slots__ attribute for this. Converting a dict to json is as simple as json.dumps().

bain3 avatar Sep 27 '22 11:09 bain3

here my project, actually i'm building myself the payload, but would be better if we can use someting more generic

https://github.com/bdbogjoe/pronote-rest

bdbogjoe avatar Sep 27 '22 19:09 bdbogjoe

Hi, sorry for blocking for so long. Pronotepy's objects can now be serialized to dict. See docs for information about JSON serialization.

bain3 avatar Nov 19 '22 14:11 bain3