Skip to main content

Convertio APIs Client Library for Python

Project description

Convertio APIs Client Library for Python

Inspired by the original PHP Package but Pythonic.

This is a lightweight wrapper for the Convertio API.

Feel free to use, improve or modify this wrapper! If you have questions contact us or open an issue on GitHub.

Requirements

Developer Documentation

You can find full API reference here: https://convertio.co/api/docs/

Quickstart

Initialize convertio client:

import os
from convertio import client

convertio = client.ConvertIO(api_key=os.environ.get('CONVERTIO_API_KEY'))

Following example will convert PNG file to PDF:

from convertio.models import parameters

# Example of converting a file
payload = parameters.NewConversionParameters(
    file="https://files.jotform.com/jotformapps/proforma-invoice-template-18a679482c789d2acf0db2d6f9324d94_og.png",
    outputformat="PDF"
)
response = convertio.new_conversion(payload=payload)

OCR Quickstart

Following example will convert pages 1-3,5,7 of PDF into editable DOCX, using OCR (Optical Character Recognition) for English and Arabic languages (Full list of available languages):

from convertio.models import parameters
from convertio.languages import Languages

# OCR Example
OCR_SETTINGS = parameters.OCRParameters.OCRSettings(langs=[Languages.ARABIC.value, Languages.ENGLISH.value])
payload = parameters.NewConversionParameters(
    file="https://files.jotform.com/jotformapps/proforma-invoice-template-18a679482c789d2acf0db2d6f9324d94_og.png",
    outputformat="txt",
    options=parameters.OCRParameters(ocr_enabled=True, ocr_settings=OCR_SETTINGS)
)

response = convertio.new_conversion(payload=payload)

Installation

You can use poetry or simply pip

pip

pip install convertio-python

Poetry

poetry add convertio-python

Resources

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

convertio_python-0.1.1.tar.gz (8.7 kB view hashes)

Uploaded Source

Built Distribution

convertio_python-0.1.1-py3-none-any.whl (10.9 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