Official Python SDK for the HS Mail API
Project description
HS Mail Python SDK
Official Python SDK for the HS Mail API. Manage orders, read mailboxes, check live accounts, and generate 2FA codes.
Installation
pip install hsmail-sdk
Quick Start
from hsmail import HsMailClient
client = HsMailClient(api_key="YOUR_API_KEY")
# Ping
status = client.ping()
print("IP:", status["ip"])
# Profile
profile = client.get_profile()
print(f"Balance: {profile['balance']} BDT")
# Products
categories = client.products.list()
# Order
order = client.orders.create("product-uuid", quantity=1)
print("Order ID:", order["orderId"])
# 2FA
result = client.tools.generate_2fa("BASE32_SECRET")
print(f"Code: {result['code']} ({result['timeRemaining']}s)")
Authentication
Get your API key from the HS Mail Dashboard.
client = HsMailClient(
api_key="hs_live_xxxxxxxxxxxxxxx",
base_url="https://api.hsmail.shop", # optional
timeout=30, # seconds, optional
)
API Reference
Profile & Status
client.ping() # { status, message, ip, timestamp }
client.get_profile() # { id, name, email, balance, rankLevel, ... }
Products
client.products.list() # All categories + products
client.products.get("uuid") # Single product by UUID
Orders
client.orders.create("uuid", quantity=1)
client.orders.get("ORDER_ID")
client.orders.messages("ORDER_ID")
client.orders.send_message("ORDER_ID", message="Hello")
client.orders.reopen("ORDER_ID")
Order statuses: PENDING · PROCESSING · COMPLETED · DELIVERED · REFUNDED
Mailbox
# Outlook
client.mailbox.read_outlook(email, refresh_token, client_id)
client.mailbox.refresh_outlook_token(client_id, refresh_token)
client.mailbox.check_outlook(email, refresh_token, client_id)
# Gmail (requires GMAIL subscription)
client.mailbox.read_gmail(email, order_id)
client.mailbox.check_gmail(email)
# Facebook (requires FB subscription)
client.mailbox.check_facebook_bulk(["email:pass", ...])
client.mailbox.check_facebook("FB_USER_ID")
# Instagram (requires IG subscription)
client.mailbox.check_instagram("username")
# Hotmail Creator
client.mailbox.create_hotmail_order(["a@hotmail.com", ...], "USER_ONLY")
Tools
result = client.tools.generate_2fa("JBSWY3DPEHPK3PXP")
# { code: "123456", timeRemaining: 17 }
Error Handling
from hsmail import (
HsMailError,
InsufficientBalanceError,
RateLimitError,
AuthenticationError,
NotFoundError,
ValidationError,
)
try:
order = client.orders.create("product-uuid")
except InsufficientBalanceError:
print("Top up at https://hsmail.shop")
except RateLimitError:
import time; time.sleep(60) # Retry after 1 minute
except AuthenticationError as e:
print(f"Auth problem: {e.code}")
except HsMailError as e:
print(f"[{e.code}] {e} (HTTP {e.http_status})")
| Exception | When raised |
|---|---|
AuthenticationError |
Invalid/expired API key, banned account |
RateLimitError |
>100 requests/minute |
NotFoundError |
Resource not found |
InsufficientBalanceError |
Not enough BDT balance |
ValidationError |
Bad input, out of stock, closed order |
HsMailError |
All other errors |
Publishing to PyPI
# Install build tools
pip install build twine
# Build
python -m build
# Upload to PyPI
twine upload dist/*
License
MIT © HS Mail Team
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
hsmail_sdk-1.0.0.tar.gz
(9.6 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 hsmail_sdk-1.0.0.tar.gz.
File metadata
- Download URL: hsmail_sdk-1.0.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41b9485692f37c8d34c01a81af9ca855c2d582b8bc5cd237dd8d39f04cf17c54
|
|
| MD5 |
1e4c1f7169a7fbd14c3215403c9b59c8
|
|
| BLAKE2b-256 |
810fe90f0c3e17199d18e27662df5da36f014048e55c2bdeda8d517e3008e4ee
|
File details
Details for the file hsmail_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: hsmail_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f94ca9dffb4592f7db154cd06e576fb80caa5409a56391af9095a4086334f15d
|
|
| MD5 |
5d2885e159c8e2e9df2021cc394b5c9f
|
|
| BLAKE2b-256 |
fe6e7e1f204ff025369f6da6c8274c13b8a387b0d4ea5f1941bf5b6601a1ee29
|