Quickstart¶
This page walks the main workflow end to end. Every operation is available in
both async (the flagship) and sync forms — AsyncClient and Client
mirror httpx’s naming, and each await client.… has a no-await twin.
Fetch a manifest¶
import asyncio
import iiisight
async def main():
async with iiisight.AsyncClient() as client:
manifest = await client.fetch_manifest("https://example.org/manifest.json")
print(str(manifest.label))
asyncio.run(main())
import iiisight
with iiisight.Client() as client:
manifest = client.fetch_manifest("https://example.org/manifest.json")
print(str(manifest.label))
fetch_manifest returns a normalized Manifest. A v2
document is upgraded to the v3-shaped model automatically, so your code is the
same either way.
Walk the structure¶
for canvas in manifest.canvases:
print(canvas.width, canvas.height)
for image in canvas.images: # painting-annotation image bodies
print(image.id, image.format)
Labels are LanguageMaps — call str(...) for a
display string, or .text("en") / .get("en") for a specific language.
Pull tiles¶
async with iiisight.AsyncClient() as client:
manifest = await client.fetch_manifest("https://example.org/manifest.json")
service = await client.load_info(manifest.canvases[0]) # fetch info.json
for tile in service.tile_grid(scale_factor=4):
print(tile.url)
data = await client.fetch_region(service, region="0,0,512,512", size="256,")
with iiisight.Client() as client:
manifest = client.fetch_manifest("https://example.org/manifest.json")
service = client.load_info(manifest.canvases[0])
for tile in service.tile_grid(scale_factor=4):
print(tile.url)
data = client.fetch_region(service, region="0,0,512,512", size="256,")
One-shot helpers¶
For quick scripts you can skip the client context manager:
import iiisight, asyncio
# async
manifest = asyncio.run(iiisight.fetch_manifest("https://example.org/manifest.json"))
# sync
manifest = iiisight.fetch_manifest_sync("https://example.org/manifest.json")
Next steps¶
Fetching & clients — collections,
expand, injecting your ownhttpxclient.The normalized model — what the typed objects look like.
Tolerance & diagnostics — how imperfect documents are handled, and the lint.