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

Avoiding making multiple requests of the info.json when using the same URL #218

Open
giacomomarchioro opened this issue Dec 18, 2024 · 2 comments
Assignees

Comments

@giacomomarchioro
Copy link
Contributor

As @markpbaggett noticed it might occur that multiple requests to the same URL are done when using set_hwd_from_iiif helper for retrieving the info.json file of a IIIF resource and getting the width and the height of the image.

response = requests.get(url)

For instance this is used at least twice (at Canvas level and resource level) for each Canvas supporting image servers.

@glenrobson
Copy link
Contributor

Would it be possible to pass a info.json into set_hwd_from_iiif in case this has been done out of band.

Also this method re-uses the info.json request rather than asking for it twice:

infoJson = body.set_hwd_from_iiif(url)

@markpbaggett
Copy link
Member

markpbaggett commented Jan 14, 2025

@giacomomarchioro, another question that I've been thinking about that might be related to @glenrobson 's question.

Assuming that create_thumbnail_from_iiif() eventually gets approved and merged, it would be awesome to integrate this with the make_canvas_from_iiif() helper which also makes a request on the info.json. With what you've been working on with functools and lru_cache, what's the best way to store the request in memory or as Glen asks store and pass a cached request if the request has already occurred so that we only have to get the image info back once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants