smlng / pycayennelpp

A Cayenne Low Power Payload (CayenneLPP) decoder and encoder for Python
MIT License
20 stars 15 forks source link

Improve compatibility with MicroPython re. "base64" module #63

Closed amotl closed 3 years ago

amotl commented 4 years ago

Dear Sebastian,

while we have included the base64 module within our Terkin Datalogger, this module is not part of the MicroPython standard library.

We could pull the respective import base64 statement into the LppFrame.from_base64 class method in order to provide all the other features, even when not having installed base64 at all.

This is really just a nit you might want to consider within the next release.

Thanks again and with kind regards, Andreas.

smlng commented 4 years ago

yeah, I originally put it in because I developed pycayennelpp when working with TheThingsNetwork (TTN) and Python, and the payload which I got from TTN in python was base64 encoded - so this function was handy. However, thinking about it now the same reasoning as with the unix timestamp and datetime applies here too, i.e., the user should do the decoding.

So I agree, to remove this dependency completely and rather add documentation (+ examples) on how to handle this. However, this would also introduce an API change, breaking backwards compatibility. So this is something for release 2.0.0, for which I plan some more changes anyway.