iif image API validator

iiif-validator的Python项目详细描述


https://travis-ci.org/IIIF/image-validator.svg?branch=masterhttps://coveralls.io/repos/github/IIIF/image-validator/badge.svg?branch=master

此验证器支持 IIIF网站 http://iiif.io/api/image/validator/

安装

从PYPI安装

下面应该安装脚本、库和必要的依赖项:

pip install iiif-validator

手动安装

从源代码安装 <;https://github.com/iif/image validator>;可以使用以下命令完成:

python setup.py install

它应该安装脚本、库和必要的依赖项。请注意,setup.py包含将某些库绑定到特定版本以实现兼容性的指令。

python-magic模块需要libmagic,在Mac上,您可以使用

brew install libmagic

命令行验证程序,iiif-validate.py

对于在^{tt5}服务的图像$ 验证程序可以使用以下命令运行:

iiif-validate.py -s localhost:8000 -p prefix -i image_id --version=2.0 -v

或者类似于使用测试映像验证服务器。使用 iiif-validate-h获取参数详细信息。

与travis ci

一起使用

要安装此代码的依赖项,以下行必须 出现在.travis.yml

install:部分
install:
  - sudo apt-get update
  - sudo apt-get install libmagic-dev
  - pip install iiif_validator
  ...

然后可以在下面的命令中添加一个验证 .travis.ymlscript:部分。例如,要测试 使用基本uri http://localhost:8000/prefix运行的服务器 图片image_id1在版本1.1,级别1,可以使用:

script:
  ...
  - iiif-validate.py -s localhost:8000 -p prefix -i image_id1 --version=1.1 --level 1 --quiet

^ {TT4}$脚本成功返回0个退出代码,非零 失败时,为了与特拉维斯ci轻松合作。

运行验证服务器,iiif-validator.py

验证器服务器的主要安装在IIIF网站上 http://iiif.io/api/image/validator/

独立服务器

验证服务器在http://localhost:8080/运行 默认情况下,uri路径是测试名称,然后是查询 参数将服务器和映像的详细信息提供给 接受测试。uri模式是:

http://localhost:8080/{test_name}?server={server}&prefix={prefix}&identifer={id}&version={api_version}

例如,如果测试服务器<;https://pypi.python.org/pypi/iiif>;已安装并在本地运行:

easy_install iiif
iiif_testserver.py

它将在http://localhost:8000/设置一个服务器,并将访问日志写入stdout。我们可以使用类似http://localhost:8080/info_json?server=localhost:8000&prefix=/2.0_pil_none&identifier=67352ccc-d1b0-11e1-89ae-279075081939.png&version=2.0的请求对此运行验证测试,该请求测试info.json响应并给出json输出(这里格式很好):

{
  "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"
}

以及http://localhost:8080/rot_mirror?server=localhost:8000&prefix=/2.0_pil_none&identifier=67352ccc-d1b0-11e1-89ae-279075081939.png&version=2.0它测试镜像并给出json输出(同样格式良好):

{
  "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"
}

wsgi下的验证服务器

此处需要文档

与流浪者一起跑步

为了便于开发和本地测试,可以使用vagrant提供虚拟机。要启动vagrant,ssh-in,并在站点上运行验证器:

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-279075081939

此外,vagrant配置使用mod_wsgi和apachehttpd将验证器作为wsgi应用程序运行,可以从vm和位于http://localhost:8080/的主机访问验证器。

编辑此自述文件

这个自述文件在structuredtext中,而不是gfm中,因为这是pypi将呈现的内容。像http://rst.ninjs.org/这样的编辑器对于交互式编辑/检查很有用。

许可证

Licensed 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 at

http://www.apache.org/licenses/LICENSE-2.0

Unless 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.

LICENSE.txt

此软件中包含的数据,例如html目录中的测试映像文件,可以在CC0

下自由重用。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在JSP中添加自定义隐式对象   java MasterMindResource泄漏?   不同的c#java结果加密   java为什么安卓 studio显示“constraintlayout中缺少约束”错误?   java Make Logback将日志打印到文件中   java如何在Google应用程序引擎中设置日期时间?   jeditorpane如何阻止java HTMLEditorKit自动关闭我的标记   返回到Activity onCreate()时,不会调用java函数   java为什么我在这个对象上得到一个NullPointerException?   在java中,如何使用包含数组的参数调用图形方法?   java如何在Play framework 2应用程序中存储Akka参与者列表?   ssh使用java将文件从一个solaris 9复制到另一个solaris 9   网络Java服务器正在等待客户端响应   java Spring mvc从formBackingObject()重定向到页面   java Spark:JavaRDD<Tuple2>到javapairdd<>   java如何动态调用基类中由字符串值指定的子类方法?