No project description provided
Project description
DIGIT Client Library
A comprehensive Python client library for interacting with DIGIT (Digital Infrastructure for Governance, Impact & Transformation) services. This library provides easy-to-use interfaces for various DIGIT microservices and APIs.
Core Components
1. APIClient
The base client class that handles all HTTP requests to the DIGIT API.
Parameters:
base_url: The API endpoint (default: sandbox.digit.org)auth_token: Authentication token for API requests
Methods:
get(endpoint, params=None, stream=False, require_auth=True): Make GET requestspost(endpoint, json_data=None, data=None, additional_headers=None, params=None, files=None, require_auth=True): Make POST requests
2. Configuration
The Config class manages API settings and authentication.
Parameters:
API_ENDPOINT: Base URL for API requestsAUTH_TOKEN: Authentication token
Methods:
set_auth_token(token): Set the authentication tokenset_api_endpoint(endpoint): Set the API endpoint
Features
- Authentication and Authorization
- User Management
- Master Data Management (MDMS)
- Workflow Management
- Boundary Management
- File Storage
- Transaction Processing
- Service Request Management
- Localization Support
- OTP Services
- Reporting
- And more...
Available Services
1. Authentication Service
Handles user authentication and session management.
Methods:
get_auth_token(auth_request): Get authentication token- Parameters:
auth_request: AuthenticationRequest object with credentials
- Parameters:
update_password_no_login(request_info): Update password without login- Parameters:
request_info: Optional RequestInfo object
- Parameters:
logout(request_info): Logout user- Parameters:
request_info: Optional RequestInfo object
- Parameters:
2. User Service
Manages user operations and profiles.
Methods:
- User creation and management
- Role assignment
- Profile updates
3. MDMS Service (Master Data Management)
Handles master data operations.
Methods:
- Data retrieval
- Schema management
- Version control
4. Workflow Service
Manages business processes and workflows.
Methods:
- Process instance management
- State transitions
- Document handling
5. File Store Service
Handles file uploads and management.
Methods:
- File upload
- File retrieval
- Tag-based operations
6. Transaction Service
Manages financial transactions.
Methods:
- Payment processing
- Transaction status
- Tax calculations
7. Service Request Service
Handles service requests and complaints.
Methods:
- Request creation
- Status updates
- Attribute management
Request Configuration
The library uses a RequestConfig class for managing request parameters:
Parameters:
action: HTTP method (GET, POST, etc.)auth_token: Authentication tokenapi_id: API identifierver: API versiondid: Device IDkey: API keymsg_id: Message IDrequester_id: Requester IDts: Timestamp
Requirements
- Python 3.6 or higher
- requests>=2.31.0
- werkzeug>=3.0.1
- python-dotenv>=1.0.0
Installation
pip install -r requirements.txt
Basic Usage
from digit_client import APIClient, Config
from digit_client.services import AuthenticationService
from digit_client.models.auth import AuthenticationRequest
# Initialize configuration
Config.set_api_endpoint("https://your-digit-instance.org")
# Set auth token to pass in header
Config.set_auth_token(response['access_token'])
Example Usage Files
The library includes comprehensive examples that demonstrate how to use various services:
Service Request Examples
- Creating service definitions
- Searching service definitions
- Creating service requests
- Searching service requests
Workflow Examples
- Workflow transitions
- Workflow search and counting
- SLA management
- Business service operations
- Escalation handling
Other Available Examples:
- Localization and language support
- OTP generation and verification
- Report generation and management
- Search and indexing operations
- URL shortening services
- Transaction processing
- Encryption utilities
- File storage operations
- Master Data Management System operations
- Authorization examples
- User authentication and testing
Each example contains detailed code samples with comments explaining the functionality. These examples serve as practical guides for implementing various DIGIT services in your applications.
Use Cases
The library provides examples for the following key use cases:
Service Request Management
- Creating and managing service definitions with custom attributes
- Submitting and tracking service requests
- Searching and filtering service requests
- Managing service request status and updates
Workflow Management
- Creating and managing business processes
- Handling workflow transitions and state changes
- Managing Service Level Agreements (SLAs)
- Escalation handling and notifications
- Business service operations and configurations
Localization and Internationalization
- Managing multi-language support
- Handling translations and language-specific content
- Configuring regional settings and preferences
Authentication and Security
- User authentication and session management
- Role-based access control
- OTP (One-Time Password) generation and verification
- Secure password management
- Authorization and permission handling
Data Management
- Master Data Management System operations
- Data indexing and search functionality
- File storage and retrieval
- Data encryption and security
Transaction Processing
- Payment processing and management
- Transaction status tracking
- Financial record management
- Receipt generation and tracking
Reporting and Analytics
- Report generation and customization
- Data aggregation and analysis
- Export functionality
- Dashboard creation
Utility Services
- URL shortening and management
- File upload and download
- Data encryption and decryption
- Identity verification
Each use case is demonstrated through practical examples that show how to:
- Initialize and configure the service
- Make API calls with proper authentication
- Handle responses and errors
- Implement best practices for each service
Error Handling
The library includes custom exceptions for handling various error scenarios:
AuthenticationError: Authentication-related errorsAPIError: General API errorsValidationError: Input validation errors
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 digit_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: digit_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 63.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6e4a28e0c43c3918f1ae1735855dd4321c0946b750013e760fe9c0171e49d03
|
|
| MD5 |
adeec61cf741d1fae32456543ba5a398
|
|
| BLAKE2b-256 |
7595d3bc8ac0d26acb034095cf068f8ed05b7730002b5abd8d17f36a589c5092
|