Getting Started


Tripoli can by installed using pip.

>>> pip install tripoli


Using Tripoli to validate a IIIF document is easy.

>>> from tripoli import IIIFValidator
>>> import requests # for example

>>> iv = IIIFValidator()
>>> manifest = requests.get("")
>>> iv.validate(manifest.text)
>>> iv.is_valid

When Tripoli detects issues in a document, it provides informative errors and warnings with key paths to simplify the debugging progress.

>>> man = requests.get("")
>>> iv.validate(man)
>>> iv.is_valid

>>> iv.print_warnings()
Warning: logo SHOULD be IIIF image service. @ data['logo']
Warning: manifest SHOULD have thumbnail field. @ data['thumbnail']
Warning: Unknown key 'see_also' in 'manifest' @ data['see_also']
Warning: ImageResource SHOULD have @id field. @ data['sequences']['canvases']['images']['@id']

>>> iv.print_errors()
Error: Field has no '@language' key where one is required. @ data['metadata']['value']
Error: viewingHint 'pages' is not valid and not uri. @ data['sequences']['canvases']['viewingHint']


The IIIFValidator has a number of options to control its behaviour.

class tripoli.IIIFValidator(debug=False, collect_warnings=True, collect_errors=True, fail_fast=True, verbose=False, unique_logging=True)
collect_errors = True

Sets whether or not errors are logged.

collect_warnings = True

Sets whether or not warnings are logged. Default True.

debug = False

Sets whether or not to save tracebacks in warnings/errors.

fail_fast = True

When True, validation stops at first error hit (faster). If False, entire document will always be validated.

Note: Turning fail_fast off may cause the validator to raise unexpected exceptions if the the document is grossly invalid (for instance, if an integer is supplied where a list is expected).

unique_logging = True

If True, only one instance of duplicate logged messages will be saved. If False, all logged messages will be saved.

Example: If set to true, then if every canvas has error A, instead of having the errors (Error(A, canvas[0]), Error(A, canvas[1]), ...), you will only get Error(A, canvas[0]) (the first error of type A on a canvas).

verbose = False

If True, prints all errors and warnings as they occur. If False, errors and warnings only printed after de-duplication.

The complete interface can be found in the API guide.

Tripoli can also be configured to log extra warnings, ignore particular errors, and correct errors in manifests. Refer to the configuration section for more information.

Validating Online

You can use tripoli to validate online at Simply pass in a link to a manifest as a query parameter named ‘manifest’.

>>> curl "${MANIFEST_URL}" -H "Accept: application/json"
  "errors": [
    "Error: '@context' must be set to '' @ data['@context']",
    "Error: @context field not allowed in embedded sequence. @ data['sequences']['@context']",
    "Error: Key 'on' is required in 'annotation' @ data['sequences']['canvases']['images']['on']"
  "is_valid": false,
  "manifest_url": ${MANIFEST_URL},
  "warnings": [
    "Warning: thumbnail SHOULD be IIIF image service. @ data['thumbnail']",
    "Warning: manifest SHOULD have description field. @ data['description']",
    "Warning: logo SHOULD be IIIF image service. @ data['logo']",
    "Warning: Unknown key '@context' in 'sequence' @ data['sequences']['@context']",
    "Warning: Unknown key '@context' in 'annotation' @ data['sequences']['canvases']['images']['@context']"