Skip to content

xOKBAx/convertio-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Convertio APIs Client Library for Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages