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.2.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

convertio_python-0.1.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file convertio_python-0.1.2.tar.gz.

File metadata

  • Download URL: convertio_python-0.1.2.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Windows/10

File hashes

Hashes for convertio_python-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e8d5283d0e9c68855e4676723c9b6e1603e4a3a853bcd5f9b61ecd8a5c3dc119
MD5 ef4b51eaa41e3c6e9373af607b93f4bf
BLAKE2b-256 ea96105943ed9efe5ac994fd0f83cb22b244177819cd360c438e94fe37c9e1e1

See more details on using hashes here.

File details

Details for the file convertio_python-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: convertio_python-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Windows/10

File hashes

Hashes for convertio_python-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 882b9d691a2527bc1d9e721861bec21bc3262b039d67ee4309d9ee4b9666acaa
MD5 85824e4034365706fca4a44fe0b9e8c2
BLAKE2b-256 9621af64ea74d4560927aaa7d6101b4973ea55712cbdd4a08317f9ad1121170c

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