adafruit / Adafruit_CircuitPython_PyPortal

CircuitPython driver for Adafruit PyPortal.
MIT License
45 stars 56 forks source link

Add new feature to allow changes/additions to the fetched and parsed JSON dict #38

Closed kevinjwalters closed 4 years ago

kevinjwalters commented 5 years ago

It's useful in some cases to be able to do some post processing on the returned JSON object. This could be achieved with an optional argument called something like json_transforms allowing the PyPortal object to be created with a function or a list of functions which run over the JSON dict object from the parsed HTTP response body. These could be allowed to modify or add values to the dict which could then be picked up by the usual image_json_path mechanism.

For the case of the NASA viewer code (Adafruit Learn: PyPortal NASA Image of the Day Viewer) as there is no support for video at the moment it would be useful to be able to deal with the odd occasion when this returns a YouTube video URL and turn that into a URL with a single still image. For discussion on the problem, see Adafruit Forums: Not getting actual images from NASA Image Viewer (pyportal)

kevinjwalters commented 4 years ago

https://github.com/adafruit/Adafruit_CircuitPython_PyPortal/tree/3.1.3 is latest at the moment and does not have the json_transform enhancement.

kattni commented 4 years ago

This has been resolved.