Package: iiif-validator
This validator supports the same validations that are available on theIIIFwebsite athttp://iiif.io/api/image/validator/.InstallationInstallation from pypiThe following should install scripts, library, and the necessary dependencies:pip install iiif-validatorManual installationInstallation fromsource code
<https://github.com/IIIF/image-validator>can de done with:python setup.py installwhich should install scripts, library, and the necessary dependencies. Note thatsetup.pyincludes directives to pin certain libraries to particular versions for compatibility.Thepython-magicmodule requireslibmagicwhich, on a mac, one can install with:brew install libmagicCommand line validator,iiif-validate.pyThen for an image served athttp://localhost:8000/prefix/image_idthe validator can be run with:iiif-validate.py -s localhost:8000 -p prefix -i image_id --version=2.0 -vor similar to validate server with the test image. Useiiif-validate-hfor parameter details.Use with Travis CITo install dependencies for this code the following lines must
be present in theinstall:section of.travis.yml:install:
  - sudo apt-get update
  - sudo apt-get install libmagic-dev
  - pip install iiif_validator
  ...and then a single validation can be added to the commands under
thescript:section of.travis.yml. For example, to test a
server running with base URIhttp://localhost:8000/prefixwith
imageimage_id1at version 1.1, level 1, one might use:script:
  ...
  - iiif-validate.py -s localhost:8000 -p prefix -i image_id1 --version=1.1 --level 1 --quietTheiiif-validate.pyscript returns 0 exit code on success, non-zero
on failure, in order to work easily with Travis CI.Running the validator server,iiif-validator.pyThe primary installation of the validator server is on theIIIFwebsite athttp://iiif.io/api/image/validator/.Stand-alone serverThe validator server runs athttp://localhost:8080/by
default, the URI path is the test name and then the query
parameters give the details of the server and image to
be tested. The URI pattern is:http://localhost:8080/{test_name}?server={server}&prefix={prefix}&identifer={id}&version={api_version}As an example, if the test server <https://pypi.python.org/pypi/iiif> is installed and run locally:easy_install iiif
iiif_testserver.pywhich will set up a server athttp://localhost:8000/and write the log of accesses to STDOUT. The one can run validation tests against this with requests likehttp://localhost:8080/info_json?server=localhost:8000&prefix=/2.0_pil_none&identifier=67352ccc-d1b0-11e1-89ae-279075081939.png&version=2.0which tests theinfo.jsonresponse and gives JSON output (pretty formatted here):{
  "test": "info_json",
  "status": "success",
  "tests": ["required-field: width", "required-field: height", "type-is-int: height", "type-is-int: width", "required-field: @id", "type-is-uri: @id", "@id is correct URI", "required-field: @context", "correct-context", "required-field: protocol", "correct-protocol", "required-field: profile", "is-list", "profile-compliance", "is-list", "is-object", "required-field: scaleFactors", "required-field: width", "type-is-int: width"],
  "url": ["http://localhost:8000/2.0_pil_none/67352ccc-d1b0-11e1-89ae-279075081939.png/info.json"],
  "label": "Check Image Information"
}andhttp://localhost:8080/rot_mirror?server=localhost:8000&prefix=/2.0_pil_none&identifier=67352ccc-d1b0-11e1-89ae-279075081939.png&version=2.0which tests mirroring and will give JSON output (again pretty formatted):{
  "test": "rot_mirror",
  "status": "success",
  "tests": ["9,0:True", "0,9:True"],
  "url": ["http://localhost:8000/2.0_pil_none/67352ccc-d1b0-11e1-89ae-279075081939.png/full/full/!0/default.jpg"],
  "label": "Mirroring"
}Validator server under WSGIneed docs hereRunning with VagrantFor ease of development and local testing, you can provision a virtual machine using Vagrant. To start Vagrant, ssh in, and run the validator on a site:vagrant up
vagrant ssh
cd /vagrant
./iiif-validate.py -h
./iiif-validate.py --scheme=https -s iiif.lib.ncsu.edu -p iiif --level=2 -i 67352ccc-d1b0-11e1-89ae-279075081939In addition, the Vagrant configuration runs the validator as a WSGI application usingmod_wsgiand Apachehttpd, accessible both from with the VM as well as the host machine athttp://localhost:8080/.Editing this READMEThis README is in reStructuredText and not gfm because that is what pypi will render. An editor likehttp://rst.ninjs.org/is useful for editing/checking interactively.LicenseLicensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.SeeLICENSE.txt.Data included with this software, such as the test image files in thehtmldirectory, may be freely reused underCC0