vertopal / vertopal-cli

A small, yet powerful file conversion utility
https://www.vertopal.com
MIT License
24 stars 5 forks source link
cli command-line command-line-tool file-converter pypi-package python python-package vertopal

Vertopal-CLI

Vertopal-CLI is a small yet powerful utility that allows you to convert digital files into various formats using the Vertopal public API.

You can use Vertopal-CLI by either terminal commands or importing as a Python package.

Installing Vertopal-CLI

Vertopal-CLI is available on PyPI:

python -m pip install vertopal

You can also download the most recent version of Vertopal-CLI binaries for macOS, Windows, and Linux from the releases page or the product page.

Installer

An automatic installer is available for each different platform. It will run an install script that downloads and copy Vertopal-CLI binaries to the correct location.

Using macOS Terminal:

curl https://run.vertopal.com/cli/macos | bash

On Windows using PowerShell:

(curl https://run.vertopal.com/cli/windows).Content | iex

If you are getting any UnauthorizedAccess error, then start Windows PowerShell with the "Run as administrator" option and run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine. Now re-run the above installation command. To change the Execution Policies to its default, you can run Set-ExecutionPolicy -ExecutionPolicy Default -Scope LocalMachine.

Using Linux Terminal:

curl https://run.vertopal.com/cli/linux | bash

Using Vertopal-CLI

To use Vertopal-CLI you need to obtain an App-ID and a Security Token.

Converting files using terminal commands are very simple:

vertopal convert document.ipynb --to pdf

To view full command-line help, execute vertopal --help and vertopal convert --help in terminal.

Setting App ID and Security Token

Before executing vertopal convert commands in terminal, you need to set your obtained App-ID and Security Token in global configuration file:

vertopal config --app "your-app-id" --token "your-security-token"

Importing as Python package

Importing vertopal as a Python package makes it easy to implement file conversions in your projects.

The following code illustrates GIF to APNG conversion using the Vertopal Python package.

import vertopal

converter = vertopal.Converter(
    "MickeyMouse.gif",
    app="your-app-id",
    token="your-security-token",
)
converter.convert("apng")
converter.wait()
if converter.is_converted():
    converter.download()