umer7 / ilovepdf

Python module that wraps the iLovePDF REST API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iLovePDF

Python module that wraps the iLovePDF REST API.

Installation

$ git clone git@github.com:sdelquin/ilovepdf.git
$ cd ilovepdf
$ pipenv install

Set your settings in the .env file.

Usage

Using ilovepdf as a library

Example of compressing a file:

from ilovepdf import ILovePdf

i = ILovePdf(config.PUBLIC_KEY, config.SECRET_KEY)
i.new_task('compress')
i.add_file('input.pdf')
i.execute()
i.download('compressed_doc.pdf')

Using ilovepdf as a standalone script

Example of compressing a file:

$ python ipdf.py compress --verbose -o compressed_doc.pdf input.pdf

Disclaimer

Implemented tasks:

  • merge
  • split
  • compress
  • pdfjpg
  • imagepdf

Developer Keys

In order to work properly with the module, you will have to get the developer keys from https://developer.ilovepdf.com/. You will have to sign up and then go to Console -> My project. There you will find two keys:

  • Project key (JTI Claim) aka Public key.
  • Secret key.

Add these keys to .env file.

Tests

$> pytest

About

Python module that wraps the iLovePDF REST API


Languages

Language:Python 99.0%Language:Shell 1.0%