Python library for generating IIIF Image API urls
Project description
# piffle
Python library for generating and parsing [IIIF Image API](http://iiif.io/api/image/2.1/) URLs in an object-oriented, pythonic fashion.
[![Build Status](https://travis-ci.org/Princeton-CDH/piffle.svg?branch=master)](https://travis-ci.org/Princeton-CDH/piffle) [![Coverage Status](https://coveralls.io/repos/github/Princeton-CDH/piffle/badge.svg?branch=master)](https://coveralls.io/github/Princeton-CDH/piffle?branch=master) [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/cdhdevteam)
Piffle is tested on Python 2.7 and 3.3-3.6.
Piffle was originally developed by Emory University as a part of [Readux](https://github.com/ecds/readux>) and forked as a separate project under [emory-lits-labs](https://github.com/emory-lits-labs/).
## Installation and example use:
pip install piffle
Example use for generating an IIIF image url:
` >>> from piffle.iiif import IIIFImageClient >>> myimg = IIIFImageClient('http://image.server/path/', 'myimgid') >>> print myimg http://image.server/path/myimgid/full/full/0/default.jpg >>> print myimg.info() http://image.server/path/myimgid/info.json" >>> print myimg.size(width=120).format('png') http://image.server/path/myimgid/full/120,/0/default.png `
Example use for parsing an IIIF image url:
` >>> from piffle.iiif import IIIFImageClient >>> myimg = IIIFImageClient.init_from_url('http://www.example.org/image-service/abcd1234/full/full/0/default.jpg') >>> print myimg http://www.example.org/image-service/abcd1234/full/full/0/default.jpg >>> print myimg.info() http://www.example.org/image-service/abcd1234/info.json >>> myimg.as_dict()['size']['full'] True >>> myimg.as_dict()['size']['exact'] False >>> myimg.as_dict()['rotation']['degrees'] 0.0 `
## Development and Testing
This project uses [git-flow](https://github.com/nvie/gitflow) branching conventions.
Install locally for development (the use of virtualenv is recommended):
pip install -e .
Install test dependencies:
pip install -e “.[test]”
Run unit tests: py.test or python setup.py test
## Publishing
To upload a tagged release to [PyPI](https://pypi.python.org/pypi) with a [wheel](http://pythonwheels.com/) package:
python setup.py sdist bdist_wheel upload
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file piffle-0.3.0.tar.gz
.
File metadata
- Download URL: piffle-0.3.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0752cd9a360e2b8c38cdda12ac4c20515581a5215c6673e4afdaa3a671daee94 |
|
MD5 | 6c845f3aec188a7c8af5a0fafae284c0 |
|
BLAKE2b-256 | 29e8ce902bd4f867d316ba28e353a71478ed17f7dd8148db35cb74de5dfae253 |
File details
Details for the file piffle-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: piffle-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d080283a2e6416cbfd1b1d7441f69a668b1bd698f634be5adc5a0b628ec866f1 |
|
MD5 | 17316371bb85de49cda2502cdc3f58ec |
|
BLAKE2b-256 | b20b09f1c6adc0479506e03f1f01545802c1fa12f84314a9e02d408c38fdfd4c |