Skip to main content

Python SDK to use Carbone Render easily

Project description

Carbone Render Python SDK

Pypi Package Documentation

Python SDK to use Carbone Render easily.



pip install carbone-sdk


You can copy and run the code bellow to try.

import carbone_sdk

# SDK constructor
# The access token can be passed as an argument to the constructor CarboneSDK
# Or by the environment variable "CARBONE_TOKEN", use the command "export CARBONE_TOKEN=secret-token"
csdk = carbone_sdk.CarboneSDK("secret-token")

# The template ID, it could be an ODT, DOCX, PPTX, XLSX, ODS file, etc...
template_id = "template"
json_data = {
  "data": {
    "id": 42,
    "date": 1492012745,
    "company": {
        "name": "myCompany",
        "address": "here",
        "city": "Notfar",
        "postalCode": 123456
    "customer": {
      {"name":"product 1","priceUnit":0.1,"quantity":10,"priceTotal":1}

# Render and return the report as bytes
report_bytes = csdk.render(template_id, json_data)
fd = open("Invoice.pdf", "wb")
# voila 🎉



Tests - Run with Makefile

Install the test packages:

$ make install

To run the tests:

$ make test

To uninstall the test packages:

$ make uninstall

Tests - Run manually


$ pip install pytest
$ pip install requests_mock

To run all the test (-v for verbose output):

$ pytest -v tests

To run a groupe of tests:

$ pytest -v ./tests/

To run a single test:

$ pytest -v ./tests/

To run a single test with all the DEBUG:

$ pytest ./tests/ --log-cli-level=10

If you need to test the generation of templateId, you can use the nodejs main.js to test the sha256 generation.

$ node ./tests/main.js

👤 Author

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

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

carbone-sdk-1.0.0.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

carbone_sdk-1.0.0-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

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