ConvertAPI Python Client
Maintained. Last release 6 weeks ago, commits in 3 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install convertapiConvertAPI Python Client
Convert your files with our online file conversion API
ConvertAPI helps to convert various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files and many other manipulations. You can integrate it into your application in just a few minutes and use it easily.
Installation
Install with pip:
pip install --upgrade convertapi
Install from source with:
pip install .
Requirements
- Python 3 with
requests; tested on Python 3.10–3.14
Usage
Configuration
You can get your API credentials at https://www.convertapi.com/a
import convertapi
convertapi.api_credentials = 'api-token'
Proxy configuration
If you need to use a proxy, you can specify it using HTTPS_PROXY environment variable when running your script.
Example:
API_TOKEN=api-token HTTPS_PROXY=https://user:pass@127.0.0.1:9000/ python convert_word_to_pdf_and_png.py
File conversion
Convert a file to PDF example. All supported file formats and options can be found here.
result = convertapi.convert('pdf', { 'File': '/path/to/my_file.docx' })
# save to file
result.file.save('/path/to/save/file.pdf')
Other result operations:
# save all result files to folder
result.save_files('/path/to/save/files')
# get conversion cost
conversion_cost = result.conversion_cost