A Python SDK for interacting with shrutiAI API
Project description
shrutiAI SDK
A Python SDK for interacting with shrutiAI API. This SDK provides a simple and intuitive interface for developers to integrate with your API service.
Features
- 🔐 API Key Authentication - Secure authentication using API keys
- 🛡️ Error Handling - Comprehensive error handling with custom exceptions
- 📊 Type Hints - Full type hints for better IDE support
- 🔄 Retry Logic - Built-in retry mechanisms for network failures
- 📝 Well Documented - Extensive documentation and examples
Installation
From PyPI (when published)
pip install shrutiAI-sdk
From Source
git clone https://github.com/yourusername/shrutiAI-sdk.git
cd shrutiAI-sdk
pip install -e .
Install Dependencies
pip install -r requirements.txt
Quick Start
from shrutiAI import ShrutiAIClient
# Initialize the client
client = ShrutiAIClient(api_key="your-api-key-here")
# Create a new user
user = client.create_user(
name="John Doe",
email="john.doe@example.com"
)
# Get all users
users = client.get_users(limit=10)
# Create a post
post = client.create_post(
title="Hello World",
content="This is my first post!",
user_id=user['id']
)
API Methods
User Management
get_users(limit=10, offset=0)- Get list of usersget_user(user_id)- Get a specific usercreate_user(name, email, **kwargs)- Create a new userupdate_user(user_id, **kwargs)- Update a userdelete_user(user_id)- Delete a user
Posts Management
get_posts(user_id=None, limit=10)- Get list of postscreate_post(title, content, user_id)- Create a new post
Analytics
get_analytics(start_date, end_date)- Get analytics data
Utility
health_check()- Check API healthget_api_info()- Get API information
Error Handling
The SDK provides custom exceptions for different error scenarios:
from shrutiAI import ShrutiAIClient, AuthenticationError, RateLimitError, NotFoundError
try:
client = ShrutiAIClient("invalid-key")
users = client.get_users()
except AuthenticationError:
print("Invalid API key!")
except RateLimitError:
print("Rate limit exceeded!")
except NotFoundError:
print("Resource not found!")
Configuration
You can customize the SDK behavior:
# Custom base URL
client = ShrutiAIClient(
api_key="your-key",
base_url="https://your-custom-api.com/v1"
)
Examples
See example_usage.py for a complete example of how to use the SDK.
python example_usage.py
Development
Setup Development Environment
pip install -e .[dev]
Run Tests
pytest
Code Formatting
black shrutiAI/
Type Checking
mypy shrutiAI/
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
Support
For issues and questions:
- GitHub Issues: https://github.com/yourusername/shrutiAI-sdk/issues
- Email: your.email@example.com
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
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 shrutiai_sdk-1.0.0.tar.gz.
File metadata
- Download URL: shrutiai_sdk-1.0.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8641fd2c35ff1e47b3b4f3fa72438a23e05723320fd003ad09ae35247e37356a
|
|
| MD5 |
948d4535972966f34e45713d987a9389
|
|
| BLAKE2b-256 |
ab8246cf9d3c1cc4659dc47ca083c01d85bcebf274ddf6de009e5a39aa4f0014
|
File details
Details for the file shrutiai_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: shrutiai_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfbad2b1d128f74626f41e9220d7f3e31d2f62af8437d5226328ae48b4d9b9dc
|
|
| MD5 |
b2807c3d01d3661a71771929e8f708be
|
|
| BLAKE2b-256 |
b3619860c065cc0245181d35ca95a47b03ba15a4466ed9f9d135a55cf19af327
|