-
Notifications
You must be signed in to change notification settings - Fork 55
Description
I have experimented with initializing a PyPortal object using json_transform=(myTransform),. Based on debug print statements, the transform function I wrote seems to be called after the .fetch() method has completed (or at least at the very end of the .fetch() method). I want to be able to edit (transform) the JSON/dict immediately upon it's creation -- before the image_json_path (or the json_path) is put to use.
For example, I'm trying to adapt the https://learn.adafruit.com/cleveland-museum-of-art-pyportal-frame project to the Art Institute of Chicago's Public API. The Cleveland project uses image_json_path to locate a .JPG file to display. For the Art Institute of Chicago, the .JPG location can only be found by concatenating the values from two separate key:value pairs and a couple of string constants.
I.e., my json_transform would
json_out["joinedKeys"] = json_out["config"]["iiif_url"] + "/" + json_out["data"][0]["imageID"] + "/full/!320,240/0/default.jpg"
That would leave me free to initialize the PyPortal object with
image_json_path = ["joindKeys"],
I can imagine other use cases for accessing or modifying the JSON/dict data immediately after its creation.
Thank you