Unofficial AsiaCell Python SDK
Project description
AsiaCell SDK
A modern Python SDK for interacting with AsiaCell APIs.
Features
- Token-based authentication
- Profile parsing
- Balance retrieval
- Voucher top-up
- Typed response models
- Session management
- Random User-Agent rotation
- Custom exceptions
- Lightweight and easy to use
Installation
pip install asiacell
Quick Start
from asiacell import AsiaCellClient
client = AsiaCellClient(
token="YOUR_TOKEN"
)
profile = client.get_profile()
print(profile.name)
print(profile.phone)
print(profile.balance.amount)
Authentication
The SDK currently supports Bearer Token authentication.
from asiacell import AsiaCellClient
client = AsiaCellClient(
token="YOUR_JWT_TOKEN"
)
You can also set or clear the token later:
client.set_token("TOKEN")
client.clear_token()
Profile
Retrieve account profile information.
profile = client.get_profile()
print(profile.name)
print(profile.phone)
print(profile.photo)
Profile Object
profile.name
profile.phone
profile.photo
profile.balance
Balance
balance = client.get_balance()
print(balance.amount)
Voucher Top-Up
result = client.topup(
msisdn="077XXXXXXXX",
voucher="1234567890"
)
print(result.success)
print(result.message)
TopUpResult Object
result.success
result.message
result.raw
Random User-Agent Rotation
client.rotate_user_agent()
Exceptions
The SDK provides custom exceptions:
from asiacell.exceptions import (
AsiacellError,
AuthenticationError,
APIError,
VoucherUsedError
)
Example:
try:
client.get_profile()
except AuthenticationError:
print("Invalid token")
except APIError as e:
print(e)
Models
Profile
Profile(
name: str,
phone: str,
photo: str,
balance: Balance
)
Balance
Balance(
amount: int
)
TopUpResult
TopUpResult(
success: bool,
message: str,
raw: dict
)
Example
from asiacell import AsiaCellClient
client = AsiaCellClient(
token="YOUR_TOKEN"
)
profile = client.get_profile()
print(profile.name)
print(profile.balance.amount)
result = client.topup(
msisdn=profile.phone,
voucher="1234567890"
)
print(result.message)
Requirements
- Python 3.9+
- requests
- fake-useragent
Legal Disclaimer
This project is an unofficial SDK and is not affiliated with or endorsed by AsiaCell.
Use responsibly and in compliance with applicable terms of service.
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
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 asiacellclient-1.0.0.tar.gz.
File metadata
- Download URL: asiacellclient-1.0.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23de866a68bd973c3bdeace0c8872dd8cc4ada253b47c2025f84b76a6151ef42
|
|
| MD5 |
0f1e6a243c9ade6b5054473d5b99fef6
|
|
| BLAKE2b-256 |
e16af6541260446727cf38227b7a077c5b2c69de677e4ccbe7d3fe3d73c7e834
|
File details
Details for the file asiacellclient-1.0.0-py3-none-any.whl.
File metadata
- Download URL: asiacellclient-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a7a36d862fbb725cae7188a3d704085c70e631d61bb35aa6307b7f8097d646b
|
|
| MD5 |
e3efceb70a1cfbb837e5541b67aa6068
|
|
| BLAKE2b-256 |
83f3eddd15f4efd0e905ea3ec244268f4ad1c3dd0b61bcea27fb52f23f8879e8
|