Skip to main content

Simple wrapper for tempmail.so api.

Project description

sotempmail

A simple Python async wrapper for the tempmail.so API.

Features

  • Create and delete temporary inboxes
  • List available domains
  • List inboxes and emails
  • Retrieve and delete emails

Requirements

  • Python 3.9+
  • aiohttp (installed automatically)

Installation

Install from PyPI:

pip install sotempmail

Or with Poetry:

poetry add sotempmail

Or with Pipenv:

pipenv install sotempmail

Usage

You need a RapidAPI key and a Bearer token from tempmail.so. See tempmail.so docs for details.

import asyncio
from sotempmail import TempMailSo

async def main():
    api_key = "<YOUR_RAPIDAPI_KEY>"
    bearer = "<YOUR_BEARER_TOKEN>"
    tm = TempMailSo(api_key, bearer)

    # List available domains
    domains = await tm.list_domains()
    print("Domains:", domains)

    # Create an inbox
    inbox_id = await tm.create_inbox(name="myinbox", domain=domains[0].get("domain"), lifespan=60)
    print("Created inbox:", inbox_id)

    # List inboxes
    inboxes = await tm.list_inboxes()
    print("Inboxes:", inboxes)

    # List emails in inbox
    emails = await tm.list_emails(inbox_id)
    print("Emails:", emails)

    # If emails exist, retrieve the first one
    if emails:
        email_id = emails[0]["_id"]
        email = await tm.retrieve_email(inbox_id, email_id)
        print("Email:", email)

        # Delete the email
        await tm.delete_email(inbox_id, email_id)
        print("Email deleted.")

    # Delete the inbox
    await tm.delete_inbox(inbox_id)
    print("Inbox deleted.")

asyncio.run(main())

Links

License

MIT

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

sotempmail-0.1.3.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

sotempmail-0.1.3-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file sotempmail-0.1.3.tar.gz.

File metadata

  • Download URL: sotempmail-0.1.3.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.4 Linux/6.15.3-200.fc42.x86_64

File hashes

Hashes for sotempmail-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1f809f6ea9d6b162aee54c6e1ff74e7122d7165eabfef7c80d91c3686d679865
MD5 37c6a536da399b643f838b4d8c3727d1
BLAKE2b-256 04bec2ca96539f11e4d37da6cdc11b25da49220b9998467bef811b5ab0ebfff1

See more details on using hashes here.

File details

Details for the file sotempmail-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: sotempmail-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.4 Linux/6.15.3-200.fc42.x86_64

File hashes

Hashes for sotempmail-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e29de8659499458d3d5c6fe19b5e4f7bc770bd03c1be65f3753d2a1935ce481a
MD5 28d4a255ee35483a06db1d85ae402c39
BLAKE2b-256 3c572e4ea889358615ad81483f055900434feded4f6a7561bb646af9586705ab

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