-
Notifications
You must be signed in to change notification settings - Fork 3
1. Getting started
The best method to get started is to have a look at Cookbook and find the relative example in the example folder of pyIIIFpres project. It is easy to modify the provided example and design interactively a manifest that suits your need.
Change the base URL (in the newer version the final slash is required).
from IIIFpres import iiifpapi3
iiifpapi3.BASE_URL = "https://iiif.io/api/cookbook/recipe/0009-book-1/"
manifest = iiifpapi3.Manifest()
When setting the ID use the extendbase_url
for appending the BASE_URL
:
annotation.set_id(extendbase_url="canvas/page/annotation"])
The ID will be: https://iiif.io/api/cookbook/recipe/0009-book-1/canvas/page/annotation
The inspect method can give you a quick view of the Required
and Suggested
fields.
manifest.inspect()
Most of the add_
methods return a handler that can be used for modifying the object.
cnv = manifest.add_canvastoitems()
cnv.inspect()
Using inspect()
on the handler will return only the hints for populating it. Inspecting nested objects in the terminal
could be painful. .show_errors_in_browser()
opens a browser tab, showing the required and recommended fields.
Don't forget that each class has also the method .__dict__
. For instance manifest.__dict__
returns a compact representation of the manifest showing only the types of the items and the ID of the items.
manifest.__dict__
Use .json_save()
on the root element to save the JSON file.
manifest.json_save()
Or .json_dumps()
for dumping it as string.
manifest.json_dumps()