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.1.tar.gz (4.9 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.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: walamail-0.1.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for walamail-0.1.1.tar.gz
Algorithm Hash digest
SHA256 eb0155eb89a3aac34de93ac1d38b5170fc16bef3fb9244f63b25b595da50960c
MD5 dc0c721b3e86df91834f2dfa784d2831
BLAKE2b-256 3034a03df56d06c2d40b88fae923271c1cffed873560f9d9aad62c0faf826936

See more details on using hashes here.

File details

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

File metadata

  • Download URL: walamail-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for walamail-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7f78fa2ac1cf9038f8b560834adf986707f220c48f2aca9a1333757463d6366
MD5 033b373a9b33230a335de92cbf635c96
BLAKE2b-256 4b39ea9c2b5b2dacf8f8f061991075f12120b3ed94d06a3900ff84efd371afa1

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