Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Allow json_transforms prior to json_path or image_url_path usage. #126

Open
w8HAQRHkTx7r opened this issue Nov 25, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@w8HAQRHkTx7r
Copy link

w8HAQRHkTx7r commented Nov 25, 2022

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

@tekktrik tekktrik added the enhancement New feature or request label Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants