Skip to main content

Python API Wrapper for WalaMail

Project description

WalaMail API Wrapper

A professional Python client library for interacting with the WalaMail API. This wrapper allows you to automate account management, check balances, and handle bulk purchases with custom formatting.


🚀 Installation

You can install the wrapper directly using pip:

pip install walamail

Note: Requires requests library (handled automatically by pip).


🔑 Authentication

Access requires an API Token. You can generate or retrieve your token from the WalaMail Dashboard under User Settings > API Keys.

All requests are authenticated via the Authorization: Bearer <token> header, which the client handles automatically.


📖 Quick Start

from walamail import WalaMailClient

# 1. Initialize the client
client = WalaMailClient(api_token="your_api_token", base_url="http://localhost:3000")

# 2. Check your balance
balance_info = client.get_balance()
print(f"💰 Balance: ${balance_info['balance']}")

# 3. Check what's in stock
stock = client.get_stock()
for item in stock:
    print(f"📦 {item['name']} - Price: ${item['price']} - Available: {item['stock']}")

🛠️ Detailed Method Reference

WalaMailClient(api_token, base_url="http://localhost:3000")

Constructs the API client.

  • api_token (str): Your secret API key.
  • base_url (str): The root URL of your WalaMail deployment.

get_balance()

Returns current user financial state.

  • Returns: {"balance": float, "transactions": [...]}
  • Use Case: Monitoring credit before running large automation batches.

get_stock()

Lists all active products and their real-time inventory levels.

  • Returns: List[{"id": int, "name": str, "price": float, "stock": int, ...}]
  • Use Case: Checking if Microsoft/Outlook accounts are available before attempting a purchase.

purchase(product_id, quantity, format="oauth", delimiter="|")

Bulk purchase accounts with customizable output format.

  • Arguments:
    • product_id (int): The numeric ID of the product.
    • quantity (int): Number of accounts to buy.
    • format (str):
      • oauth: Full credentials including Refresh Token and Client ID (default).
      • standard: Only email|password.
    • delimiter (str): Delimiter character. Options: |, :, -.
  • Returns:
    {
      "tradeNo": "WM...",
      "quantity": 5,
      "totalAmount": 0.05,
      "credentials": [
        "email|pass|token|id",
        "email|pass|token|id"
      ]
    }
    

get_accounts(page=1, limit=50)

Retrieves your order history and previously purchased accounts.

  • Returns: Paginated list of account records including emails and associated order IDs.

get_account_details(account_id)

Get technical details for a specific account, including direct instructions for Microsoft Graph API integration.

  • Returns: Configuration object for the specific account.

list_mail_accounts()

Helper specifically for the Mail Proxy system. Returns a list of accounts that can be used with the mailbox reading endpoints.


🧪 Advanced Example: Automated Purchase Flow

from walamail import WalaMailClient

client = WalaMailClient("YOUR_TOKEN")

# Find a specific product (e.g., 'Trusted Outlook')
stock = client.get_stock()
target_product = next((p for p in stock if "Trusted" in p["name"]), None)

if target_product and target_product["stock"] >= 5:
    # Buy 5 accounts in standard format using colon separator
    order = client.purchase(
        product_id=target_product["id"],
        quantity=5,
        format="standard",
        delimiter=":"
    )
    
    print(f"Order {order['tradeNo']} completed!")
    for account_line in order['credentials']:
        email, password = account_line.split(":")
        print(f"Purchased: {email}")
else:
    print("Stock insufficient or product not found.")

⚠️ Error Handling

The wrapper raises exceptions for API errors (4xx/5xx). It is recommended to wrap calls in try-except blocks.

try:
    client.get_balance()
except Exception as e:
    print(f"Request failed: {e}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

walamail-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

walamail-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file walamail-0.1.0.tar.gz.

File metadata

  • Download URL: walamail-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/44.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.6.3 tqdm/4.67.1 importlib-metadata/8.7.0 keyring/25.7.0 rfc3986/1.5.0 colorama/0.4.6 CPython/3.14.0

File hashes

Hashes for walamail-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fa4e9b27b2ef49e787fce604adeb3d313d2f3bd962a7221184b2a8fed85292db
MD5 2f459da7680bcdcaed1c3f3d50d288e9
BLAKE2b-256 6d5b1646337b74ff68b5e7cd4d5f0fd4f96e9fb684d7f354282bc81727560d10

See more details on using hashes here.

File details

Details for the file walamail-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: walamail-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/44.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.6.3 tqdm/4.67.1 importlib-metadata/8.7.0 keyring/25.7.0 rfc3986/1.5.0 colorama/0.4.6 CPython/3.14.0

File hashes

Hashes for walamail-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dd9ec7d90f758bd6bfac72fd12a69f62e1b42423584ff585452fd55ae173725
MD5 280d28a841093ff91c78314afaedb854
BLAKE2b-256 aa9778145b59a2d8e61aabe616f96b4d87e1f96fb9ffd8b8fd9a822df3472e92

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