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.
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 thePyPortal
object to be created with a function or a list of functions which run over the JSONdict
object from the parsed HTTP response body. These could be allowed to modify or add values to thedict
which could then be picked up by the usualimage_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)