Skip to main content

Python api client made for iLoveIMG & iLovePDF based on iLoveAPI (https://www.iloveapi.com/docs/api-reference).

Project description

iloveapi-python

Python api client made for iLoveIMG & iLovePDF based on iLoveAPI (https://www.iloveapi.com/docs/api-reference).

Features

  • Fully typed code
  • Asyncio support
  • REST API & workflow API encapsulation

Installation

pip install iloveapi

Getting Started

Simply compress image:

from iloveapi import ILoveApi

client = ILoveApi(
    public_key="<project_public_******>",
    secret_key="<secret_key_******>",
)
task = client.create_task("compressimage")
task.process_files("p1.png")
task.download("output.png")

Multiple images:

task = client.create_task("compressimage")
task.process_files(
    "p1.png",
    ("custom_name.png", "p2.png"),
    ("custom_name.png", b"..PNG..."),
    {
        "file": b"..PNG...",
        "filename": "custom_name.png",
        "rotate": 2,  # add image parameter
        "password": "xxx",  # for PDF
    }
)
task.download("output.zip")  # zip format

Async support:

task = await client.create_task_async("compressimage")
await task.process_files_async("p1.png")
await task.download_async("output.png")

Directly call REST API:

response = client.rest.start("compressimage")  # getting httpx response
response = await client.rest.start_async("compressimage")  # async

TODO

  • Typed parameter for all processing tools
  • Command-line interface

Why not pydantic?

Image / PDF processing tools usually focus on results rather than JSON data, as data type validation is not important to the user.

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

iloveapi-1.0.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

iloveapi-1.0.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file iloveapi-1.0.0.tar.gz.

File metadata

  • Download URL: iloveapi-1.0.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.24.2 CPython/3.11.4 Linux/6.6.87.1-microsoft-standard-WSL2

File hashes

Hashes for iloveapi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0237f95f6e150fa70de8b85ec01e85625f41022bcd659a7824d1d7acd8a4d440
MD5 5bc1c98885834cee30afe3d14944b509
BLAKE2b-256 02a792902e2a7acd1c83264f556337cc264f6ed8128d2787a6fd0c820684b1a4

See more details on using hashes here.

File details

Details for the file iloveapi-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: iloveapi-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.24.2 CPython/3.11.4 Linux/6.6.87.1-microsoft-standard-WSL2

File hashes

Hashes for iloveapi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c14e65d5af370e287c302aa4cf5d5e751951cf33123b8b6b4b3586990b8d07ea
MD5 b2c1352547f360cd3db7fa3ef2a3e13c
BLAKE2b-256 f2d700095cd6e48a1ca9b909bac7dc4aa1c050af694ee1d85ea67dff338b797e

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