Skip to main content

A client library for accessing Gotenberg

Reason this release was yanked:

Broken multi-file upload

Project description

Python client for Gotenberg

Usage

First, create a client:

from gotenberg_client import Client

client = Client(base_url="http://gotenberg:3000")

If the endpoints you're going to hit require authentication, use AuthenticatedClient instead:

from gotenberg_client import AuthenticatedClient

client = AuthenticatedClient(base_url="http://gotenberg:3000", token="SuperSecretToken")

Now call your endpoint and use your models:

from typing import Any
from gotenberg_client.models import URLConversionRequestBody
from gotenberg_client.api.chromium import post_forms_chromium_convert_url
from gotenberg_client.types import Response

response: Response[Any] = post_forms_chromium_convert_url.sync_detailed(
   client=client, body=URLConversionRequestBody(url="http://example.org")
)
pdf: bytes = response.content

Or do the same thing with an async version:

from typing import Any
from gotenberg_client.models import URLConversionRequestBody
from gotenberg_client.api.chromium import post_forms_chromium_convert_url
from gotenberg_client.types import Response

response: Response[Any] = await post_forms_chromium_convert_url.asyncio_detailed(
   client=client, body=URLConversionRequestBody(url="http://example.org")
)
pdf: bytes = response.content

By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.

client = AuthenticatedClient(
    base_url="https://gotenberg.svc", 
    token="SuperSecretToken",
    verify_ssl="/path/to/certificate_bundle.pem",
)

You can also disable certificate validation altogether, but beware that this is a security risk.

client = AuthenticatedClient(
    base_url="https://gotenberg.svc", 
    token="SuperSecretToken", 
    verify_ssl=False
)

Since Gotenberg returns binary responses (application/pdf), the auto-parsing feature of openapi-python-client is omitted.

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

gotenberg-client-7.0.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gotenberg_client-7.0.0-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file gotenberg-client-7.0.0.tar.gz.

File metadata

  • Download URL: gotenberg-client-7.0.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.4 Linux/5.17.9-1-MANJARO

File hashes

Hashes for gotenberg-client-7.0.0.tar.gz
Algorithm Hash digest
SHA256 e5455cbf26f0b99ab991d7e9a891cc2c7a5953d475a9a5c1cab8b7b6634b04d7
MD5 52b3b91c6b678eaa50f7e9ae17018eeb
BLAKE2b-256 369feb81153e4b8f63ddea5d4c0d933d9aed3b219a1429e2ec1be49bf3eadb4d

See more details on using hashes here.

File details

Details for the file gotenberg_client-7.0.0-py3-none-any.whl.

File metadata

  • Download URL: gotenberg_client-7.0.0-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.4 Linux/5.17.9-1-MANJARO

File hashes

Hashes for gotenberg_client-7.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45523d146ff8ed5611d243c8de91c26489b79f112a71c4b3a80ffef13eac38b5
MD5 fee895a02d12095fb7089186011389bb
BLAKE2b-256 3efdb3c3932ef5b4e26fc73a5e504ebc30934527259b623229dcf3c18574b32a

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