Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 docraptor
Octocat-spinner-32 example
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 AUTHORS.rst
Octocat-spinner-32 HISTORY.rst
Octocat-spinner-32 LICENSE
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.rst
Octocat-spinner-32 requirements.txt
Octocat-spinner-32 setup.py
README.rst

python-docraptor

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
Something went wrong with that request. Please try again.