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.2.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.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sotempmail-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 101c1fef8348d2967939e642dde6ecf01ae41af3653b9d95d418eeaada4cee7f
MD5 3864e3b34ba291c72dbd649cbe072539
BLAKE2b-256 596476846b24b1a00a0fd6d599bdc003f7641ec986fd33932131518f338d757e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sotempmail-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e8815202e4be5455d9ee9996a983eaae56d2b04d2a5540f31c9eed5783c5c832
MD5 40119c732f0da80df8592755fed8bc4e
BLAKE2b-256 8191bf9a734c3533267cfd51cbbb599eec5f4e4b3f7ca31c3e4e1977403e44f7

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