IPP with Python is now more fun

December 4, 2013

post-pyipptool
At ezeep we benefit quite a lot from the amazing work of the open source community. We think open source is the key to deliver better and more reliable software that doesn’t lock in users and developers. Today we’re happy to announce the release of pyipptool, a small but useful Python library that makes it easier to work with IPP requests from your Python code.

pyipptool wraps the ipptool executable to perform IPP request to any device or service that speaks this protocol. It exposes some ready to use functions like get_jobs_request or create_printer_subscription_request with pythonic arguments, and returns the response nicely casted into Python objects with help of plistlib.

So why not just use pycups or pkipplib? pycups is tightly coupled with CUPS itself. You need to have CUPS binaries installed on the same machine to use it. pkipplib doesn’t expose all IPP operations and its API is, despite being a standalone Python application, not very pythonic.

We decided to use ipptool because this executable is standalone, available for every platform and takes care of all the underlying IPP details. You just need to provide an IPP request that follows the ipptoolfile format. The only missing link was that there was no convenient way to put ipptool to use for you directly from your Python code. That’s why we built pyipptool.

pyipptool generates the ipptoolfile for you and calls ipptool to generate the IPP request. pyipptool parses the response and gives it back to the caller. Each ipptoolfile grammar is controlled by a schema and generated by a form engine. The libraries Colander and Deform are used underneath.

Check it out on GitHub:

pyipptool on GitHub