Skip to main content

A Python package for the Peslac API

Project description

Peslac API Client

A Python package to interact with the Peslac API for document management and AI-powered tools.

Installation

Install the Peslac API Client using pip:

pip install peslac

Usage

Initializing the Client

First, import the Peslac class and create an instance with your API key:

from peslac import Peslac

client = Peslac(api_key="your-api-key-here")

Examples

Using a Local File

# Use a tool with a local file
file_path = "path/to/your/document.pdf"
tool_id = "your-tool-id"
response = client.use_tool(file_path, tool_id)
print("Tool Response:", response)

Using a Remote File URL

# Use a tool with a remote file URL
file_url = "https://example.com/document.pdf"
tool_id = "your-tool-id"
response = client.use_tool_with_file_url(file_url, tool_id)
print("Response:", response)

Retrieving a Document

# Retrieve a document
document_id = "your-document-id"
response = client.retrieve_document(document_id)
print("Document Response:", response)

Submitting and Retrieving a Bank Statement

# Submit a bank statement
file_path = "path/to/bank_statement.pdf"
type_of_account = "savings"
currency = "USD"
response = client.submit_bank_statement(file_path, type_of_account, currency)
print("Bank Statement Submission Response:", response)

# Retrieve the bank statement
document_id = "your-document-id"
response = client.retrieve_bank_statement(document_id)
print("Bank Statement Response:", response)

API Reference

Peslac(api_key)

Creates a new instance of the Peslac client.

  • api_key (string): Your Peslac API key.

retrieve_document(document_id)

Retrieves a document by its ID.

  • document_id (string): The ID of the document you want to retrieve.
  • Returns: A dictionary with the document details.

use_tool(file_path, tool_id)

Uses an AI-powered tool on a document.

  • file_path (string): Path to the file you want to process.
  • tool_id (string): ID of the tool you want to use.
  • Returns: A dictionary with the tool usage result.

use_tool_with_file_url(file_url, tool_id)

Uses an AI-powered tool with a remote file URL.

  • file_url (string): URL of the file you want to process.
  • tool_id (string): ID of the tool you want to use.
  • Returns: A dictionary with the tool usage result.

submit_bank_statement(file_path, type_of_account, currency)

Submits a bank statement with additional metadata.

  • file_path (string): Path to the bank statement file.
  • type_of_account (string): Type of account (e.g., savings, checking).
  • currency (string): The currency of the account (e.g., USD, EUR).
  • Returns: A dictionary with the submission result.

retrieve_bank_statement(document_id)

Retrieves a bank statement by its ID.

  • document_id (string): The ID of the bank statement you want to retrieve.
  • Returns: A dictionary with the bank statement details.

Error Handling

All methods raise exceptions if operations fail. It's recommended to use try-except blocks when calling these functions:

try:
    response = client.retrieve_document("invalid-document-id")
    print("Document Response:", response)
except Exception as e:
    print("Error:", e)

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Support

For support or questions, please contact:

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

peslac-0.1.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

peslac-0.1.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: peslac-0.1.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for peslac-0.1.2.tar.gz
Algorithm Hash digest
SHA256 17f7db1c9c1dad478e5ede218157dfc9851b48232d086dcd32f54879923d90be
MD5 baf3532c5bd3e46d9698f4b91a3fa528
BLAKE2b-256 11c6c4ac66f9c0e4b7be4da2d947d320f854cdbc919d7a15e74c1a194f0bfde5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: peslac-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for peslac-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51ae4885f116a4b2754a051a17c33702a06f5d88ef9640d64de1f10e419b3a47
MD5 a4731b4611d880ed6f174261bd896dc7
BLAKE2b-256 eb572bb24faae7d2963c302096ac0829d6d0ba26bda17b74180e0f71574f8180

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