Python SDK for Altan API
Project description
Altan SDK
Python SDK for the Altan API, providing easy access to integration and database functionality.
Installation
pip install altan-sdk
Quick Start
Integration
import asyncio
from altan_sdk import Integration
async def main():
# Initialize the SDK with your API key
integration = Integration(altan_api_key="your-api-key-here")
# Create connections for any platform using connection_id
instagram = integration("your-instagram-connection-id")
salesforce = integration("your-salesforce-connection-id")
slack = integration("your-slack-connection-id")
# Execute an action on Instagram
result = await instagram.execute(
action_type_id="post_photo",
payload={
"image_url": "https://example.com/image.jpg",
"caption": "Hello from Altan SDK!"
}
)
print(f"Success: {result['success']}")
print(f"Data: {result['data']}")
# Execute an action on Salesforce
sf_result = await salesforce.execute(
action_type_id="create_lead",
payload={
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com"
}
)
# Close connections when done
await integration.close_all_connections()
# Run the async function
asyncio.run(main())
Using Context Managers
import asyncio
from altan_sdk import Integration
async def main():
async with Integration(altan_api_key="your-api-key-here") as integration:
# Use any connection by its ID
instagram = integration("your-instagram-connection-id")
result = await instagram.execute(
action_type_id="get_profile",
payload={}
)
print(result)
asyncio.run(main())
Features
- Integration Management: Easy access to various social media and platform integrations
- Action Execution: Execute actions on connected platforms
- Error Handling: Comprehensive error handling with custom exceptions
- Async Support: Built with async/await for efficient I/O operations
- Type Hints: Full type hint support for better development experience
Flexible Connection Support
The SDK supports any connection available in your Altan account (5000+ integrations):
# Create connections using their connection IDs
instagram = integration("instagram_connection_id")
salesforce = integration("salesforce_connection_id")
slack = integration("slack_connection_id")
hubspot = integration("hubspot_connection_id")
shopify = integration("shopify_connection_id")
# ... and any other connection you have configured
# Alternative syntax (equivalent)
connection = integration.connection("any_connection_id")
Error Handling
from altan_sdk import Integration, AltanAPIError, AltanConnectionError
async def main():
integration = Integration(altan_api_key="your-api-key")
connection = integration("your-connection-id")
try:
result = await connection.execute("action_id", {"key": "value"})
except AltanAPIError as e:
print(f"API Error: {e}")
print(f"Status Code: {e.status_code}")
print(f"Response Data: {e.response_data}")
except AltanConnectionError as e:
print(f"Connection 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
altan_sdk-0.1.0.tar.gz
(6.3 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 altan_sdk-0.1.0.tar.gz.
File metadata
- Download URL: altan_sdk-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
882d3722400260cbcc5079cd827d43584868e02dbab62772ffe389dd9e1506e3
|
|
| MD5 |
d34da5a4ad6beb569724ff3c87999e0a
|
|
| BLAKE2b-256 |
03ce3cae44add5ad4f90297553c65e6ac94cd5a4b811151e489276c08264831a
|
File details
Details for the file altan_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: altan_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37a051dd8d57a84ee7a2d2a6d078a1ce75e3bf0a9dfffb819d5fa92ae8ea1be5
|
|
| MD5 |
17b14a3d137fc13543e73b9567d14b73
|
|
| BLAKE2b-256 |
2e31e2bc61608b3a74536bef56d676119814fc41f116c779004ca2716437f46e
|