Skip to main content

testlie

Python client for Testlie: disposable email inboxes for end-to-end tests, waiting for an email, and pulling one-time codes and magic links out of it. Standard library only (urllib), Python 3.9+, typed, with a pytest plugin.

30-second quick start

  1. Sign up at testlie.com (free plan) and create a key on the API keys page.
  2. Install and point the client at it:
pip install testlie
export TESTLIE_API_KEY=tl_...                # a read-only key can wait and extract
# export TESTLIE_URL=https://testlie.example  # only for a self-hosted server
  1. Use it in a test:
from testlie import Testlie

testlie = Testlie()  # TESTLIE_API_KEY, TESTLIE_URL

with testlie.disposable_inbox(minutes=15) as inbox:
    # inbox.smtp has host, ports, username and password for your app's SMTP settings
    sign_up(email=inbox.address("alice"))          # <alias>+alice@<inbound domain>
    email = testlie.wait_for_email(inbox.id, to=inbox.address("alice"), subject="Confirm", timeout=60)
    code = testlie.extract_otp(email)              # "482913"
    link = testlie.extract_link(email, "verify")   # first magic link or link containing "verify"

Records returned by the API are dicts that also allow attribute access (inbox.id, inbox["smtp"]["password"]).

API

Call Description
inboxes.list(), get(id), create(name=, max_messages=, project_id=, disposable_minutes=) Inboxes with SMTP credentials
inboxes.update(id, name=..., max_messages=...), delete(id), clear(id), mark_all_read(id), rotate_credentials(id)
messages.list(inbox_id, q=, unread=, page=, limit=) {"total", "messages": [...]}, newest first
messages.get(m), raw(m) (bytes), html(m), attachment(m, id), delete(m), mark_read(m), forward(m, to)
messages.extract(m) {"links", "codes", "magicLinks"}, best first
messages.wait_for(inbox_id, to=, subject=, since=, timeout=30) Long-poll, returns the summary
wait_for_email(...) Same, returns the full message
extract_otp(m), extract_link(m, pattern=None) The code / the best or first matching link
disposable_inbox(minutes=30, name=None) Context manager; deletes the inbox on exit
webhooks.list/create/update/delete, idps.list/create/get/update/delete/users/add_user/delete_user

m is a message ID or a message dict. timeout is in seconds; waits over two minutes are split into several long-polls. pattern is a compiled regex or a case-insensitive substring, matched against magic links first, then every link, on the URL and the link text.

Errors: TestlieError (status, code, upgrade_url, body; status 0 for network errors), TestlieTimeoutError (408) and TestlieExtractError. GET, PUT and DELETE are retried on 429, 5xx and network errors with exponential backoff, honouring Retry-After.

pytest

The plugin is registered automatically when the package is installed.

def test_signup_sends_code(testlie, testlie_inbox, page):
    address = testlie_inbox.address("signup")
    page.goto("/signup"); page.fill("#email", address); page.click("text=Sign up")
    email = testlie.wait_for_email(testlie_inbox.id, to=address, subject="code")
    page.fill("#code", testlie.extract_otp(email))
  • testlie: session-wide client.
  • testlie_inbox: a fresh disposable inbox per test, deleted afterwards.
  • --testlie-url URL overrides TESTLIE_URL; the ini option testlie_inbox_minutes (default 30) sets the inbox lifetime.

Development

pip install -e . pytest
pytest                     # uses a local http.server fake of the API
python -m build && twine check dist/*

MIT licensed. Copyright (c) 2026 Carrier Grade Inc.

Metadata

Release files for testlie 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for testlie 0.1.0
File Size Uploaded Provenance
testlie-0.1.0.tar.gz 17.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for testlie 0.1.0
File Interpreter ABI Platform
testlie-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.5 kB

Release files / testlie-0.1.0.tar.gz

Download URL testlie-0.1.0.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2b9da6edf13933e725e766825af606941bc7c4d9604ad1da23838d691418e167
BLAKE2b-256 checksum
How to use checksums
8317a96bc10e2ec6a4a457376aac5a89efc391e176ffe7fa0f06faac8c5bdc17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / testlie-0.1.0-py3-none-any.whl

Download URL testlie-0.1.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
748597a8f3909b09fc3437767a52f41b922128ceda0938a0acf72b631a9a17fc
BLAKE2b-256 checksum
How to use checksums
9f7edf50478a76794810d837207f1c5080d1a0cb63a14233e9c5b2e4ca49d5d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for testlie 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for testlie-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page