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.4.tar.gz (4.3 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.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: peslac-0.1.4.tar.gz
  • Upload date:
  • Size: 4.3 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.4.tar.gz
Algorithm Hash digest
SHA256 6416a918bd3a549091d78756041afb4f7fdb957ba8d303ffe86f9d55468b3da6
MD5 808b6939b5e04b8edda11dba1cc25d2d
BLAKE2b-256 f7f82ee33c24ccbf96822804444f62d6137da493f16365ec6c6b7e6dbc485b39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: peslac-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ee0f136d0d2f16c8da5e2ed93b8a9fa1b6b2c0aa5ba7a0b11cdb0af04dc86bd2
MD5 ca45f5381d68edf2ea8a29c3417f0e98
BLAKE2b-256 a02b6c7a9ea9dd0181498d067b82e6210d30a0a46469c3d40f97367c48c53d04

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