Python client library for APAL secure P2P communication platform
Project description
APAL Python Client
A Python client library for the APAL secure P2P communication platform.
Installation
pip install apal-client
Quick Start
import asyncio
from apal_client import APALClient
from uuid import UUID
async def main():
# Initialize client
client = APALClient(
base_url="http://localhost:8000",
email="your@email.com",
password="your-password"
)
# Register a new business account
account = await client.register(
email="business@example.com",
password="secure-password",
business_name="Example Business"
)
# Send a message
message = await client.send_message(
receiver_id=UUID("receiver-uuid"),
content={
"type": "payment",
"data": {
"amount": 100.00,
"currency": "USD",
"payment_method": "bank_transfer",
"reference_id": "PAY-123456"
}
}
)
# List messages
messages = await client.list_messages()
# Get message status
status = await client.get_message_status(message["id"])
if __name__ == "__main__":
asyncio.run(main())
Features
- Asynchronous API client
- Automatic authentication handling
- Message encryption/decryption
- Error handling and validation
- Support for all APAL API endpoints
Environment Variables
The client can be configured using environment variables:
APAL_API_KEY: Your API keyAPAL_EMAIL: Your registered emailAPAL_PASSWORD: Your passwordAPAL_BASE_URL: API base URL (default: http://localhost:8000)
Error Handling
The client raises custom exceptions for different error cases:
from apal_client import (
APALError,
ValidationError,
AuthenticationError,
MessageError,
APIError
)
try:
await client.send_message(...)
except ValidationError as e:
print(f"Message validation failed: {e}")
except AuthenticationError as e:
print(f"Authentication failed: {e}")
except MessageError as e:
print(f"Message processing failed: {e}")
except APIError as e:
print(f"API error: {e}")
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
apal_client-0.1.0.tar.gz
(3.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apal_client-0.1.0.tar.gz.
File metadata
- Download URL: apal_client-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d12360fdade16cd31ecc3f449a5a204d6247907b6fe3c07f6718d9789c4a2002
|
|
| MD5 |
cf24eb41f48f92d5eabb0fc6043a3a45
|
|
| BLAKE2b-256 |
e2111f707f42e91216a823f528dcc21ca7b65b2c163f0386a3a9e0e8ffa4e2cc
|
File details
Details for the file apal_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: apal_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e671d1834e01fa6a3bfeabbd0afca27e25718f80d73c66ae5a9d709039b4d27
|
|
| MD5 |
4ff69ad8bc5400c6883d15500ee699e1
|
|
| BLAKE2b-256 |
b2c8c1e0671e8385c88e5da975b016255a04c3529cfb32fa39d59e982f0efc6c
|