API reference¶
The complete public API, generated from the source docstrings. Everything here is
importable directly from the top-level iiisight package (e.g.
iiisight.AsyncClient, iiisight.Manifest).
Clients¶
The client facades: AsyncClient (flagship) and Client (sync).
Both fetch IIIF documents over HTTP and hand the body to
normalize(), returning the normalized model with its
diagnostics attached. All network I/O is explicit here — the model never fetches
behind attribute access. expand() resolves a collection’s references, and
resolve() fetches a single reference; both are the only ways to trigger the
follow-on requests a collection or reference implies.
The two facades share every pure helper in this module; only the httpx call
differs (async vs. sync). Class names mirror httpx so its users have no
surprise.
- iiisight.client.DEFAULT_CONCURRENCY = 8¶
Default cap on concurrent fetches when expanding a collection (async only).
- class iiisight.client.AsyncClient(*, http_client=None, timeout=30.0, concurrency=8)[source]¶
Bases:
objectAn async IIIF client over a shared
httpx.AsyncClientconnection pool.Use as an async context manager. Pass
http_clientto reuse an existinghttpx.AsyncClient(e.g. with custom auth/caching); iiisight then does not close it.- async aclose()[source]¶
Close the underlying httpx client, unless it was supplied externally.
- Return type:
None
- async fetch(url)[source]¶
Fetch and normalize a manifest or collection (auto-detected).
- Parameters:
url (str)
- Return type:
- async fetch_collection(url)[source]¶
Fetch a URL expected to be a Collection.
- Parameters:
url (str)
- Return type:
- async resolve(reference)[source]¶
Fetch the document a reference points at.
- Parameters:
reference (Reference)
- Return type:
- async expand(collection)[source]¶
Resolve a collection’s items one level deep, preserving order.
Embedded items are returned as-is; references are fetched (concurrently, bounded by the client’s
concurrency).- Parameters:
collection (Collection)
- Return type:
- async load_info(target)[source]¶
Fetch an image service’s
info.jsonand return the loaded service.- Parameters:
target (ImageService | Canvas)
- Return type:
- async fetch_region(service, region='full', size='max', **url_kwargs)[source]¶
Fetch the image bytes for a region/size from an image service.
- Parameters:
service (ImageService)
region (str)
size (str)
url_kwargs (str)
- Return type:
- async search(target, query, params=None)[source]¶
Run a Content Search against a resource’s search service.
- Parameters:
- Returns:
An
AnnotationPageof hit annotations.- Return type:
- async probe(probe_service, token=None)[source]¶
Call an auth probe service to check access, optionally with a token.
- Parameters:
probe_service (ProbeService)
token (str | None)
- Return type:
- async access_token(token_service)[source]¶
Non-interactive token exchange against an access token service.
- Parameters:
token_service (AccessTokenService)
- Return type:
- async check_compliance(target)[source]¶
Probe an image service for Image API conformance.
Loads
info.json(if needed), then issues the requests appropriate to the claimed compliance level and verifies the returned image dimensions.- Parameters:
target (ImageService | Canvas | str) – an image service base URL, an
ImageService, or aCanvas(its primary image service is used).- Return type:
- async fetch_changes(url)[source]¶
Fetch a Change Discovery
OrderedCollection(the activity stream).- Parameters:
url (str)
- Return type:
- async iter_activities(source, *, newest_first=True, since=None)[source]¶
Walk a change stream, yielding activities across pages.
- Parameters:
source (ChangeCollection | str) – a change-collection URL or a fetched
ChangeCollection.newest_first (bool) – walk from
lastbackwards (recent changes first); setFalsefor an oldest-first full sync fromfirst.since (str | None) – an
endTimestring; only strictly-newer activities are yielded (and newest-first paging stops once it reaches older ones).
- Return type:
- class iiisight.client.Client(*, http_client=None, timeout=30.0)[source]¶
Bases:
objectA synchronous IIIF client — the same surface as
AsyncClientwithoutawait. Use as a context manager.- Parameters:
http_client (Client | None)
timeout (float)
- close()[source]¶
Close the underlying httpx client, unless it was supplied externally.
- Return type:
None
- fetch(url)[source]¶
Fetch and normalize a manifest or collection (auto-detected).
- Parameters:
url (str)
- Return type:
- fetch_collection(url)[source]¶
Fetch a URL expected to be a Collection.
- Parameters:
url (str)
- Return type:
- resolve(reference)[source]¶
Fetch the document a reference points at.
- Parameters:
reference (Reference)
- Return type:
- expand(collection)[source]¶
Resolve a collection’s items one level deep, preserving order.
- Parameters:
collection (Collection)
- Return type:
- load_info(target)[source]¶
Fetch an image service’s
info.jsonand return the loaded service.- Parameters:
target (ImageService | Canvas)
- Return type:
- fetch_region(service, region='full', size='max', **url_kwargs)[source]¶
Fetch the image bytes for a region/size from an image service.
- Parameters:
service (ImageService)
region (str)
size (str)
url_kwargs (str)
- Return type:
- search(target, query, params=None)[source]¶
Run a Content Search against a resource’s search service.
- probe(probe_service, token=None)[source]¶
Call an auth probe service to check access, optionally with a token.
- Parameters:
probe_service (ProbeService)
token (str | None)
- Return type:
- access_token(token_service)[source]¶
Non-interactive token exchange against an access token service.
- Parameters:
token_service (AccessTokenService)
- Return type:
- check_compliance(target)[source]¶
Probe an image service for Image API conformance (see AsyncClient).
- Parameters:
target (ImageService | Canvas | str)
- Return type:
- async iiisight.client.fetch(url)[source]¶
One-shot async fetch of a manifest or collection.
- Parameters:
url (str)
- Return type:
- async iiisight.client.fetch_collection(url)[source]¶
One-shot async fetch of a Collection.
- Parameters:
url (str)
- Return type:
- iiisight.client.fetch_sync(url)[source]¶
One-shot sync fetch of a manifest or collection.
- Parameters:
url (str)
- Return type:
Normalization¶
Model¶
The normalized IIIF model — a v3-shaped consumer subset of the Presentation
API, produced by iiisight.normalize.normalize().
Every type is a frozen dataclass and every collection field is a tuple defaulting
to empty (never None), so tolerant traversal never trips on a missing list.
Derived views (Canvas.images, Canvas.image_service) are pure
properties over the parsed fields — they never perform I/O.
- class iiisight.model.MetadataEntry(label, value)[source]¶
Bases:
objectA single
metadata(orrequiredStatement) label/value pair.- Parameters:
label (LanguageMap)
value (LanguageMap)
- label: LanguageMap¶
- value: LanguageMap¶
- class iiisight.model.Link(id, type=None, label=None, format=None, profile=None, language=())[source]¶
Bases:
objectAn external link:
homepage,rendering,seeAlso, orlogo.- Parameters:
- label: LanguageMap | None = None¶
- class iiisight.model.Agent(id, type='Agent', label=None, homepage=(), logo=(), see_also=())[source]¶
Bases:
objectA
provideragent.- Parameters:
id (str)
type (str)
label (LanguageMap | None)
logo (tuple[ContentResource, ...])
- label: LanguageMap | None = None¶
- logo: tuple[ContentResource, ...] = ()¶
- class iiisight.model.Selector(type, value=None, conforms_to=None)[source]¶
Bases:
objectA target selector (fragment
xywh/t, point, SVG, or Image API).
- class iiisight.model.SpecificResource(source, selector=None)[source]¶
Bases:
objectA reference to part of a resource: a source id plus an optional selector.
- class iiisight.model.Reference(id, type, label=None)[source]¶
Bases:
objectAn unresolved pointer (a collection or range item): id/type/label only.
- Parameters:
id (str)
type (str)
label (LanguageMap | None)
- label: LanguageMap | None = None¶
- class iiisight.model.Service(id, type=None, profile=None, label=None, context=None, raw=None)[source]¶
Bases:
objectA non-image service on a resource (search, autocomplete, auth, …).
Image API services attach to a
ContentResourceasImageService; this generic type carries the manifest/canvas-level services (e.g. a Content Search endpoint) so callers can discover them.- Parameters:
- label: LanguageMap | None = None¶
- class iiisight.model.Size(width, height)[source]¶
Bases:
objectA discrete available image size from
info.jsonsizes.
- class iiisight.model.TileSet(width, height, scale_factors)[source]¶
Bases:
objectA
tilesentry: tile dimensions plus the scale factors it serves.
- class iiisight.model.Tile(region, size, url)[source]¶
Bases:
objectA single computed tile request (region/size/URL).
- class iiisight.model.ImageService(id, api_version, compliance_level=None, loaded=False, protocol=None, width=None, height=None, max_width=None, max_height=None, max_area=None, sizes=(), tiles=(), preferred_formats=(), extra_formats=(), extra_qualities=(), extra_features=())[source]¶
Bases:
objectAn Image API service attached to a content resource.
Carries only what the manifest embedded (usually
id+ profile) untilclient.load_info()setsloadedand populates the rest frominfo.json. Phase 1 produces the unloaded stub; the loaded fields and the URL/tile helpers arrive in Phase 4.- Parameters:
- url(region='full', size='max', rotation='0', quality='default', fmt=None)[source]¶
Build an Image API URL for this service.
size="max"emitsfullfor a v2 service andmaxfor v3 — the most common v2/v3 footgun — and other size tokens pass through unchanged.- Parameters:
- Returns:
The assembled
{id}/{region}/{size}/{rotation}/{quality}.{fmt}URL.- Return type:
- thumbnail_url(width)[source]¶
Return a full-image URL near
widthpx, preferring an advertised size.When
sizesare advertised (the level-0-safe path), the smallest size at leastwidthwide is used, else the largest available; otherwise a plain{width},size is requested.
- tile_grid(scale_factor, quality='default', fmt=None)[source]¶
Enumerate the tile requests covering the whole image at
scale_factor.Requires a service populated by
client.load_info().- Raises:
ImageServiceNotLoaded – If
info.jsonhas not been loaded.UnknownScaleFactor – If no tileset advertises
scale_factor.
- Parameters:
- Return type:
- class iiisight.model.ContentResource(id, type, format=None, height=None, width=None, duration=None, label=None, language=(), service=(), services=())[source]¶
Bases:
objectA painting/supplementing body: image, A/V, text, dataset, or model.
- Parameters:
- label: LanguageMap | None = None¶
- service: tuple[ImageService, ...] = ()¶
- class iiisight.model.TextualBody(value='', type='TextualBody', format=None, language=())[source]¶
Bases:
objectAn inline textual annotation body (e.g. a comment).
- class iiisight.model.Annotation(id, type='Annotation', motivation=(), body=None, target=None)[source]¶
Bases:
objectA Web Annotation: a motivation, a body, and a target.
- Parameters:
id (str)
type (str)
body (ContentResource | TextualBody | tuple[ContentResource | TextualBody, ...] | None)
target (str | SpecificResource | None)
- body: ContentResource | TextualBody | tuple[ContentResource | TextualBody, ...] | None = None¶
- target: str | SpecificResource | None = None¶
- class iiisight.model.AnnotationPage(id, type='AnnotationPage', items=())[source]¶
Bases:
objectA page of annotations.
- Parameters:
id (str)
type (str)
items (tuple[Annotation, ...])
- items: tuple[Annotation, ...] = ()¶
- class iiisight.model.Described(id, type, label=None, metadata=(), summary=None, required_statement=None, rights=None, provider=(), thumbnail=(), homepage=(), rendering=(), see_also=(), part_of=(), services=(), behavior=(), nav_date=None, raw=None)[source]¶
Bases:
objectThe Presentation “descriptive properties” shared by most resources.
- Parameters:
id (str)
type (str)
label (LanguageMap | None)
metadata (tuple[MetadataEntry, ...])
summary (LanguageMap | None)
required_statement (MetadataEntry | None)
rights (str | None)
thumbnail (tuple[ContentResource, ...])
nav_date (str | None)
- label: LanguageMap | None = None¶
- metadata: tuple[MetadataEntry, ...] = ()¶
- summary: LanguageMap | None = None¶
- required_statement: MetadataEntry | None = None¶
- thumbnail: tuple[ContentResource, ...] = ()¶
- class iiisight.model.Canvas(id, type, label=None, metadata=(), summary=None, required_statement=None, rights=None, provider=(), thumbnail=(), homepage=(), rendering=(), see_also=(), part_of=(), services=(), behavior=(), nav_date=None, raw=None, height=None, width=None, duration=None, items=(), annotations=())[source]¶
Bases:
DescribedA view/page: spatial (
height/width) and/or temporal (duration).- Parameters:
id (str)
type (str)
label (LanguageMap | None)
metadata (tuple[MetadataEntry, ...])
summary (LanguageMap | None)
required_statement (MetadataEntry | None)
rights (str | None)
thumbnail (tuple[ContentResource, ...])
nav_date (str | None)
height (int | None)
width (int | None)
duration (float | None)
items (tuple[AnnotationPage, ...])
annotations (tuple[AnnotationPage, ...])
- items: tuple[AnnotationPage, ...] = ()¶
- annotations: tuple[AnnotationPage, ...] = ()¶
- property images: list[ContentResource]¶
Painting-annotation image bodies on this canvas, in document order.
- property image_service: ImageService | None¶
The first Image API service on this canvas’s images, if any.
- class iiisight.model.Range(id, type, label=None, metadata=(), summary=None, required_statement=None, rights=None, provider=(), thumbnail=(), homepage=(), rendering=(), see_also=(), part_of=(), services=(), behavior=(), nav_date=None, raw=None, items=(), start=None)[source]¶
Bases:
DescribedA structural range (table-of-contents node).
- Parameters:
id (str)
type (str)
label (LanguageMap | None)
metadata (tuple[MetadataEntry, ...])
summary (LanguageMap | None)
required_statement (MetadataEntry | None)
rights (str | None)
thumbnail (tuple[ContentResource, ...])
nav_date (str | None)
items (tuple[Canvas | Range | SpecificResource | Reference, ...])
start (Canvas | SpecificResource | None)
- start: Canvas | SpecificResource | None = None¶
- class iiisight.model.Manifest(id, type, label=None, metadata=(), summary=None, required_statement=None, rights=None, provider=(), thumbnail=(), homepage=(), rendering=(), see_also=(), part_of=(), services=(), behavior=(), nav_date=None, raw=None, canvases=(), structures=(), annotations=(), start=None, viewing_direction=None, diagnostics=<factory>)[source]¶
Bases:
DescribedA single object: its canvases, structures, and manifest-level annotations.
- Parameters:
id (str)
type (str)
label (LanguageMap | None)
metadata (tuple[MetadataEntry, ...])
summary (LanguageMap | None)
required_statement (MetadataEntry | None)
rights (str | None)
thumbnail (tuple[ContentResource, ...])
nav_date (str | None)
annotations (tuple[AnnotationPage, ...])
start (Canvas | SpecificResource | None)
viewing_direction (str | None)
diagnostics (tuple[Diagnostic, ...])
- annotations: tuple[AnnotationPage, ...] = ()¶
- start: Canvas | SpecificResource | None = None¶
- diagnostics: tuple[Diagnostic, ...]¶
- class iiisight.model.Collection(id, type, label=None, metadata=(), summary=None, required_statement=None, rights=None, provider=(), thumbnail=(), homepage=(), rendering=(), see_also=(), part_of=(), services=(), behavior=(), nav_date=None, raw=None, items=(), viewing_direction=None, diagnostics=<factory>)[source]¶
Bases:
DescribedA grouping of manifests and/or sub-collections (often as references).
- Parameters:
id (str)
type (str)
label (LanguageMap | None)
metadata (tuple[MetadataEntry, ...])
summary (LanguageMap | None)
required_statement (MetadataEntry | None)
rights (str | None)
thumbnail (tuple[ContentResource, ...])
nav_date (str | None)
items (tuple[Manifest | Collection | Reference, ...])
viewing_direction (str | None)
diagnostics (tuple[Diagnostic, ...])
- items: tuple[Manifest | Collection | Reference, ...] = ()¶
- diagnostics: tuple[Diagnostic, ...]¶
Language maps¶
The LanguageMap value type for IIIF language maps.
IIIF represents human-readable strings (label, summary, metadata
labels/values) as language maps: a mapping of BCP-47 language code to a list of
string values, with the special key "none" for values with no language.
LanguageMap wraps that shape so callers can pull a display string
without hand-indexing {"en": ["..."]}.
- class iiisight.language.LanguageMap(values=None)[source]¶
Bases:
objectAn immutable IIIF language map (
lang -> list[str]).Construct from a mapping of language code to a list of strings. The
"none"key holds values with no associated language.
Diagnostics¶
Structured diagnostics emitted while normalizing a IIIF document.
Tolerance is the core invariant: the normalizer never raises on a spec-imperfect
document. Instead it repairs what it can and records each repair as a
Diagnostic. Severity encodes how lossy the repair was; even ERROR
never raises.
- class iiisight.diagnostics.Severity(*values)[source]¶
Bases:
EnumHow lossy a normalization repair was.
- Variables:
INFO – Spec-sanctioned normalization (e.g. a default the spec allows).
WARNING – A deviation that was repaired (missing recommended field, coerced type) without losing information.
ERROR – Something that could not be represented and had to be dropped or skipped; the model is lossy at
pathbut still usable, and no exception was raised.
- INFO = 'info'¶
- WARNING = 'warning'¶
- ERROR = 'error'¶
- class iiisight.diagnostics.Diagnostic(code, severity, path, message, recovered=None)[source]¶
Bases:
objectA single repair the normalizer made to a document.
- Variables:
code (str) – Stable machine-readable code, e.g.
"coerced-language-map".severity (iiisight.diagnostics.Severity) – How lossy the repair was.
path (str) – JSON pointer to the offending node (
""for the root).message (str) – Human-readable description of what was wrong.
recovered (str | None) – What was assumed, coerced, or skipped to recover, if anything.
- Parameters:
Image API¶
Content Search¶
IIIF Content Search: discover a resource’s search service and parse results.
A manifest (or canvas) advertises a Content Search service in its service
block; find_search_service() locates it. search_url() builds the
query URL, and parse_search_response() normalizes the response — a v3
AnnotationPage or a v2 sc:AnnotationList — into an
AnnotationPage of hit annotations. client.search()
ties these together.
- iiisight.search.find_search_service(resource)[source]¶
Return the Content Search service on a resource, or
None.
Content State¶
IIIF Content State API 1.0: decode and encode shareable references.
A content state points at a IIIF resource (a manifest, a canvas, a region of a
canvas) in a form that can be passed around — most commonly a base64url-encoded
(padding-stripped) JSON annotation, but also a plain resource URI or inline JSON.
decode() turns any of those into a ContentState, whose
reference can be handed to client.resolve to fetch the
containing document. encode() produces the compact base64url token.
- exception iiisight.content_state.ContentStateError[source]¶
Bases:
IIISightErrorA content-state token could not be decoded.
- class iiisight.content_state.ContentState(target_id, target_type=None, part_of=None, region=None, raw=None)[source]¶
Bases:
objectA decoded content state.
- Variables:
target_id (str) – The referenced resource id (a canvas, manifest, etc.).
target_type (str | None) – Its type, if known.
part_of (str | None) – The containing manifest id, if the target is within one.
region (str | None) – A selector/fragment value (e.g.
xywh=0,0,10,10), if any.raw (dict[str, Any] | None) – The decoded annotation, when the token carried one.
- Parameters:
- iiisight.content_state.decode(token)[source]¶
Decode a content-state token into a
ContentState.- Parameters:
token (str)
- Return type:
Authorization Flow¶
IIIF Authorization Flow 2.0 (metadata + non-interactive token exchange).
iiisight describes the auth services on a resource and can drive the
non-interactive parts of the flow — probing whether a resource is accessible and
exchanging for an access token where the token service is directly callable
(e.g. an external profile relying on cookies). The interactive login step
(opening the access service in a browser and reading the token via postMessage)
is inherently the host application’s job and is out of scope; iiisight gives you
the service metadata to drive it.
The auth services are a nested tree (AuthProbeService2 → AuthAccessService2
→ AuthAccessTokenService2 / AuthLogoutService2) carrying fields outside the
normalized subset, so they are parsed from each Service’s
preserved raw JSON.
- class iiisight.auth.LogoutService(id, label=None)[source]¶
Bases:
objectAn
AuthLogoutService2.- Parameters:
id (str)
label (LanguageMap | None)
- label: LanguageMap | None = None¶
- class iiisight.auth.AccessTokenService(id, error_heading=None, error_note=None)[source]¶
Bases:
objectAn
AuthAccessTokenService2— where a token is obtained.- Parameters:
id (str)
error_heading (LanguageMap | None)
error_note (LanguageMap | None)
- error_heading: LanguageMap | None = None¶
- error_note: LanguageMap | None = None¶
- class iiisight.auth.AccessService(id, profile=None, label=None, heading=None, note=None, confirm_label=None, token_service=None, logout_service=None)[source]¶
Bases:
objectAn
AuthAccessService2— where the user authenticates.- Parameters:
id (str)
profile (str | None)
label (LanguageMap | None)
heading (LanguageMap | None)
note (LanguageMap | None)
confirm_label (LanguageMap | None)
token_service (AccessTokenService | None)
logout_service (LogoutService | None)
- label: LanguageMap | None = None¶
- heading: LanguageMap | None = None¶
- note: LanguageMap | None = None¶
- confirm_label: LanguageMap | None = None¶
- token_service: AccessTokenService | None = None¶
- logout_service: LogoutService | None = None¶
- class iiisight.auth.ProbeService(id, access_services=())[source]¶
Bases:
objectAn
AuthProbeService2— the entry point to a resource’s auth flow.- Parameters:
id (str)
access_services (tuple[AccessService, ...])
- access_services: tuple[AccessService, ...] = ()¶
- property token_service: AccessTokenService | None¶
The first access token service among the access services, if any.
- class iiisight.auth.ProbeResult(status, location=None, heading=None, note=None)[source]¶
Bases:
objectThe result of calling a probe service (
AuthProbeResult2).- Parameters:
status (int)
location (str | None)
heading (LanguageMap | None)
note (LanguageMap | None)
- heading: LanguageMap | None = None¶
- note: LanguageMap | None = None¶
- class iiisight.auth.TokenResult(access_token=None, expires_in=None, error=None)[source]¶
Bases:
objectThe result of a non-interactive token exchange.
- iiisight.auth.find_probe_service(resource)[source]¶
Find the auth probe service on a resource, if it is access-controlled.
Accepts a
Canvas(searches its images’ services), aContentResource, a bareService, or any resource with aserviceslist.- Parameters:
resource (Described | ContentResource | Service)
- Return type:
ProbeService | None
- iiisight.auth.probe_service_from(service)[source]¶
Parse a
Serviceinto aProbeService, orNone.- Parameters:
service (Service)
- Return type:
ProbeService | None
Lint¶
Consumer-oriented lint over the diagnostics a normalization produced.
This is the byproduct the tolerance design unlocks: because
normalize() records every repair it made, a lint is just
a reporting view over document.diagnostics — “what did a real client have to
guess or fix to read this document?” It is client-compatibility feedback, not a
strict spec-conformance check.
- class iiisight.lint.LintReport(diagnostics)[source]¶
Bases:
objectThe diagnostics from normalizing a document, organized for reporting.
- Parameters:
diagnostics (tuple[Diagnostic, ...])
- diagnostics: tuple[Diagnostic, ...]¶
- property errors: tuple[Diagnostic, ...]¶
Diagnostics where information was dropped or skipped.
- property warnings: tuple[Diagnostic, ...]¶
Diagnostics for deviations that were repaired without loss.
- property infos: tuple[Diagnostic, ...]¶
Diagnostics for spec-sanctioned normalizations.
- iiisight.lint.lint(document)[source]¶
Lint a IIIF document.
- Parameters:
document (Manifest | Collection | Mapping[str, Any]) – An already-normalized
Manifest/Collection, or a raw parsed JSONdict(which is normalized first).- Returns:
A
LintReportover the document’s diagnostics.- Return type:
Conformance¶
Image API conformance probing.
Given a loaded ImageService, this plans a battery of
Image API requests appropriate to the service’s claimed compliance level, and —
for requests whose output size is predictable — verifies that the server returns
an image of the expected pixel dimensions, not merely an HTTP 200.
Dimensions are read straight from the returned image’s header (JPEG / PNG / GIF)
with image_size(), so no image-decoding dependency is required. When a
response is in a format we can’t measure, the check verifies reachability only and
says so. The client drives the requests (iiisight.AsyncClient.check_compliance());
the planning and evaluation here are pure.
- class iiisight.conformance.Check(name, level, url, ok, detail)[source]¶
Bases:
objectThe result of a single conformance request.
- class iiisight.conformance.ConformanceReport(service_id, claimed_level, checks)[source]¶
Bases:
objectThe result of probing an image service.
- class iiisight.conformance.CheckSpec(name, level, url, expected)[source]¶
Bases:
NamedTupleA planned request: what to fetch and the expected output dimensions.
- iiisight.conformance.plan_checks(service)[source]¶
Plan the conformance requests for a loaded image service.
- Parameters:
service (ImageService)
- Return type:
Change Discovery¶
IIIF Change Discovery API 1.0: consume a repository’s activity stream.
A publisher exposes a W3C Activity Streams OrderedCollection of paged
activities (Create / Update / Delete / …), each referencing a IIIF
resource that changed. Harvesters walk the pages to discover changed resources
and re-fetch them. This module models and parses that stream; the client
(iiisight.AsyncClient.fetch_changes() / iter_activities) walks it.
Activities are ordered oldest → newest across the collection, so a harvester
looking for recent changes walks from last backwards via prev (the
default), while a full sync walks from first forwards via next.
- class iiisight.discovery.Activity(type, object, end_time=None, id=None, actor=None)[source]¶
Bases:
objectA single change activity referencing the resource that changed.
- Parameters:
- class iiisight.discovery.ActivityPage(id, items=(), next=None, prev=None, part_of=None, start_index=None)[source]¶
Bases:
objectAn
OrderedCollectionPageof activities, with paging links.- Parameters:
- class iiisight.discovery.ChangeCollection(id, total_items=None, first=None, last=None, items=())[source]¶
Bases:
objectAn
OrderedCollection— the entry point to an activity stream.- Parameters:
- iiisight.discovery.parse_change_collection(document)[source]¶
Parse an
OrderedCollectionchange-discovery document.- Parameters:
- Return type:
- iiisight.discovery.parse_activity_page(document)[source]¶
Parse an
OrderedCollectionPageof activities.- Parameters:
- Return type:
- iiisight.discovery.page_activities(page, newest_first, since)[source]¶
Return the activities to yield from a page and whether to stop paging.
Ordering within the stream is oldest → newest;
newest_firstreverses each page.since(anendTimestring) filters to strictly-newer activities — when walking newest-first, reaching an older activity means paging can stop.- Parameters:
page (ActivityPage | ChangeCollection)
newest_first (bool)
since (str | None)
- Return type:
Errors¶
Exception types raised by iiisight.
Tolerance covers document imperfection — a malformed manifest is repaired and
reported via diagnostics, never raised. Genuine failures of the transport (a
404, a connection error, a non-JSON body) and caller-contract violations (asking
fetch_manifest for a URL that resolves to a Collection) are exceptional and
raise these types.
- exception iiisight.errors.IIISightError[source]¶
Bases:
ExceptionBase class for all errors raised by iiisight.
- exception iiisight.errors.FetchError(url, message)[source]¶
Bases:
IIISightErrorA document could not be retrieved or decoded.
- exception iiisight.errors.UnexpectedDocumentError[source]¶
Bases:
IIISightErrorA fetched document was not of the type the caller asked for.
- exception iiisight.errors.ImageServiceNotLoaded[source]¶
Bases:
IIISightErrorA tile/region operation needs an ImageService populated by
load_info().
- exception iiisight.errors.UnknownScaleFactor[source]¶
Bases:
IIISightErrorA tile was requested at a scale factor the service does not advertise.