Skip to main content

Simple API for Google Cloud Print

Project description

A simple interface to Google Cloud Print.

Usage:

>>> from googleprint import *
>>> auth = OAuth2(access_token="qwertyuiopasdfghjkl", token_token="Bearer")
>>> r = list_jobs(auth=auth)
>>> r['jobs']
[{"id": ...}, ...]
>>> r = submit_job(printer="0e506d12-dbe0-54d3-7392-fd69d45ff2fc", content="test.pdf", auth=auth)
>>> r['job']
{"id": "abcdefgh", ...}
>>> delete_job("abcdefgh", auth=auth)

Supports both Python 2 and 3:

  • ≥ Python 2.6

  • ≥ Python 3.2

Install

Use pip to install the latest version from PyPI:

pip install googleprint

Command line interface

The module can be used from the command line via:

python -m googleprint ...

See --help for details.

Tests

The test suite requires three environment variables:

  • CP_CLIENT_ID – application “client id” (Google API)

  • CP_CLIENT_SECRET – application “client secret” (Google API)

  • CP_REFRESH_TOKEN – refresh token for an authorised Google Account

  • CP_PRINTER_ID – printer ID (optional, default: __google__docs)

During the tests a PDF is printed. By default the Google Docs printer is used, however it is more forgiving than typical printers, so I don’t recommend using it.

Example:

CP_CLIENT_ID=1234567890.apps.googleusercontent.com \
CP_CLIENT_SECRET=asdfghjklzxcvbnmqwertyuiop \
CP_REFESH_TOKEN=mnbvcxzlkjhgfdspoiuytr \
CP_PRINTER_ID=0e50ed12-dbe0-54d3-a4bd-fdf9d45ff2fc \
tox

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

googleprint-0.1.5.tar.gz (10.5 kB view details)

Uploaded Source

File details

Details for the file googleprint-0.1.5.tar.gz.

File metadata

  • Download URL: googleprint-0.1.5.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for googleprint-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8b28d43f0bde6aeaef206b7186eed1633ce3f97f3750b0febf7376475d506a1c
MD5 696147f8cdf04bfb9b0ee0d2c65c01cb
BLAKE2b-256 8ec049e47ce7efe961f68c9d183659136bfbd84d038102825b020bb7bb1d6fa0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page