Skip to main content

A Python client for the Rahkaran API

Project description

Rahkaran API Client

A Python client library for interacting with the Rahkaran API.

Installation

pip install rahkaran-api

Quick Start

import json
from rahkaran_api import RahkaranAPI, RahkaranConfig

# Create config object
config = RahkaranConfig(
    rahkaran_name="code",
    server_name="localhost",
    port="80",
    username="admin",
    password="admin"
)

# Initialize the client with config
client = RahkaranAPI(config)



# Make GET request for demonstration
try:
    response = client.get(
        "/General/AddressManagement/Services/AddressManagementWebService.svc/GetRegionalDivisionList"
    )
    print(json.dumps(response, ensure_ascii=False, indent=2))    
except Exception as e:
    print(f"Error occurred: {str(e)}")

# Data for creating a party
data = [{"Type ": 1, "FirstName": "Ehsan", "LastName": "Rezaei"}]
# Make Post request
try:
    response = client.post(
        "/General/PartyManagement/Services/PartyService.svc/GenerateParty",
        data
        )
    print(json.dumps(response, ensure_ascii=False, indent=2))    
except Exception as e:
    print(f"Error occurred: {str(e)}")

Features

  • Secure authentication with RSA encryption
  • Automatic session management
  • Connection pooling and retry mechanism
  • Configurable SSL verification
  • Comprehensive error handling
  • Automatic rate limiting
  • Request timeout configuration

Development

To set up the development environment:

# Clone the repository
git clone https://github.com/yourusername/rahkaran-api.git
cd rahkaran-api

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

Running Tests

pytest tests/

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rahkaranpythonapi-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file rahkaranpythonapi-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rahkaranpythonapi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a945229ae4de65a93ca96cea4bcc3fe918318a4bea446509275e94d46c6169f1
MD5 987b20d65d2eb2373147dae2386be338
BLAKE2b-256 c20d0ad391e8f723a1dba093c9201b06fcdc5ad0fe790602cf1fff36c18536b3

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