Skip to main content

Asyncexchange

Async Microsoft Exchange / Outlook library — think exchangelib, but built on async/await and httpx.

Asyncexchange talks to Exchange via the EWS SOAP API. It covers a focused set of operations for mail and calendar. The API is designed to be extended; contributions and feature requests are welcome.

Features

  • Email — fetch inbox messages (filter by date / read status), mark as read
  • Calendar — fetch meetings (busy time) from the user's calendar in a date range
  • Async HTTP via httpx, typed models via Pydantic

Requirements

  • Python 3.13+
  • Exchange server with EWS (Exchange Web Services) enabled

Installation

pip install asyncexchange

Quick start

import asyncio
import datetime as dt

from asyncexchange.services.exchange.emails import EmailService

async def main():
    service = EmailService(
        username="user@example.com",
        password="secret",
        server_url="https://mail.example.com",
        tz=dt.timezone(dt.timedelta(hours=3)),
    )
    end = dt.datetime.now(tz=dt.timezone.utc)
    start = end - dt.timedelta(days=1)
    messages = await service.get_messages(start=start, end=end, is_read=False)
    for msg in messages:
        print(msg.subject, msg.author)
    await service.mark_as_read(messages)
    await service.aclose()

asyncio.run(main())

Scope and contributing

Asyncexchange was built around a concrete set of use cases, so it does not aim to mirror the full Exchange API. If you need more operations (folders, send, etc.), open an issue or a PR.

License

MIT License

Metadata

Release files for asyncexchange 0.2.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 asyncexchange 0.2.0
File Size Uploaded Provenance
asyncexchange-0.2.0.tar.gz 10.1 kB Without provenance Details

Release files / asyncexchange-0.2.0.tar.gz

Download URL asyncexchange-0.2.0.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
da07f31aed8b7c6b7304d8e47759536726fe298bbdfae936fec95cc598212e79
BLAKE2b-256 checksum
How to use checksums
71f328f85a4322eaa9cdba7dbc6386b46598de65bf7338aa053aae369a3d35d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for asyncexchange 0.2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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