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], 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.1.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.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sotempmail-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 51ac2f328b85b6d16aaad8bcc7ddb87d337b6b6ffa99494636d99eb354788df0
MD5 30f008d320aef6e37695f6af9608f595
BLAKE2b-256 6943ca5ba62f8f4cb87ef804e2ac7449d7c6043eb3e4ff777eb2e78fe8671bae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sotempmail-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6647d55c05f2972f414a28df87398071f4bdeafa485080e6433c9d8b132efe7d
MD5 3bf497f7bb331911e7564c88de584e06
BLAKE2b-256 8956481044453f79be19442ee4f51877876713f826d53045e13c67f99671d2ca

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