Skip to main content

Doc Raptor API wrapper

Project description

https://travis-ci.org/jkeyes/python-docraptor.png?branch=master

python-docraptor is an MIT Licensed wrapper for the docraptor API.

Synchronous Example

from docraptor import DocRaptor

docraptor = DocRaptor()
with open("test.pdf", "wb") as f:
    f.write(docraptor.create({
        'document_content': '<p>python-docraptor Test</p>',
        'test': True
    }).content)

Asynchronous Example

import time
from docraptor import DocRaptor

docraptor = DocRaptor()

resp = docraptor.create({
    'document_content': '<p>python-docraptor Async Test</p>',
    'test': True,
    'async': True
})
status_id = resp['status_id']

resp = docraptor.status(status_id)
while resp['status'] != 'completed':
    time.sleep(3)
    resp = docraptor.status(status_id)

with open("test_async.pdf", "wb") as f:
    f.write(docraptor.download(resp['download_key']).content)

Installation

To install python-docraptor, simply:

$ pip install python-docraptor

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

python-docraptor-1.2.tar.gz (3.8 kB view hashes)

Uploaded Source

Supported by

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