GitHub - ezeep/pyipptool: IPP request generator to interact with CUPS or IPP devices. (original) (raw)

pyipptool

https://travis-ci.org/ezeep/pyipptool.svg?branch=master https://coveralls.io/repos/ezeep/pyipptool/badge.png Latest PyPI version Code Health

Convenient IPP request generator for python to interrogate CUPS or IPP devices, with the help of ipptool.

Setup

Tests

Configuration

Add the following content in ~/.pyipptool.cfg or /etc/pyipptool/pyipptol.cfg.

[main] ipptool_path = /usr/bin/ipptool cups_uri = http://localhost:631/ ;If authentication is required login = admin password = secret graceful_shutdown_time = 2 timeout = 10

Where ipptool_path points to the absolute path of your installed ipptool

Usage

Create an infinite time subscription for printer-XYZ class for the rss notifier

from pyipptool import create_printer_subscription create_printer_subscription( printer_uri='http://localhost:631/classes/printer-XYZ', requesting_user_name='admin', notify_recipient_uri='rss://', notify_events='all', notify_lease_duration=0) {'Name': 'Create Printer Subscription', 'Operation': 'Create-Printer-Subscription', 'RequestAttributes': [{'attributes-charset': 'utf-8', 'attributes-natural-language': 'en', 'printer-uri': 'http://localhost:631/classes/printer-XYZ', 'requesting-user-name': 'admin'}, {'notify-events': 'all', 'notify-lease-duration': 0, 'notify-recipient-uri': 'rss://'}], 'ResponseAttributes': [{'attributes-charset': 'utf-8', 'attributes-natural-language': 'en'}, {'notify-subscription-id': 23}], 'StatusCode': 'successful-ok', 'Successful': True, 'notify-subscription-id': 23}