Skip to main content

PyPI License: MIT Python 3.10+

gmail-sdk

Python SDK for the Gmail REST API. Uses httpx directly — no google-api-python-client.

Install

pip install ldraney-gmail-sdk

Quick Start

from gmail_sdk import GmailClient

# Load token from ~/secrets/google-oauth/gmail-draneylucas.json
client = GmailClient(account="draneylucas")
print(client.get_profile())

# List unread messages
messages = client.list_messages(query="is:unread", max_results=5)

# Send an email
client.send_message(to="someone@example.com", subject="Hello", body="Hi there!")

# Reply to a message
client.reply(message_id="abc123", body="Thanks!")

# Send an HTML email
client.send_message(
    to="someone@example.com",
    subject="Hello",
    body="Plain text fallback",
    html_body="<h1>Hello!</h1><p>This is <b>HTML</b>.</p>",
)

# Reply-all, mark as read/unread
client.reply_all(message_id="abc123", body="Thanks everyone!")
client.mark_as_read(message_id="abc123")
client.mark_as_unread(message_id="abc123")

# List mailbox changes since a history ID (for incremental sync)
profile = client.get_profile()
changes = client.list_history(start_history_id=profile["historyId"])

First-Time Setup

Run the OAuth flow to authorize an account:

from gmail_sdk import GmailClient

client = GmailClient.authorize(account="draneylucas")
print(client.get_profile())

This opens a browser for Google sign-in and saves the token for future use.

Multi-Account

personal = GmailClient(account="draneylucas")
work = GmailClient(account="lucastoddraney")
dev = GmailClient(account="devopsphilosopher")

Configuration

  • Secrets directory: ~/secrets/google-oauth/ (override with secrets_dir= or GMAIL_SECRETS_DIR env var)
  • Credentials file: {secrets_dir}/credentials.json
  • Token files: {secrets_dir}/gmail-{account}.json

Metadata

Release files for gmail-sdk-ldraney 0.1.3

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

Source distribution (sdist)

Source distribution for gmail-sdk-ldraney 0.1.3
File Size Uploaded
gmail_sdk_ldraney-0.1.3.tar.gz 19.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gmail-sdk-ldraney 0.1.3
File Interpreter ABI Platform
gmail_sdk_ldraney-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 38.8 kB

Release files / gmail_sdk_ldraney-0.1.3.tar.gz

Download URL gmail_sdk_ldraney-0.1.3.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a1378d36c0a3421575794feeaaf0eeb864e919e053497d3fa9c2092c0bf5b303
BLAKE2b-256 checksum
How to use checksums
829b81cdf50aa0b0078fbebdcdcafc434cd40b786b318bebaa1dd50f2f0cab62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 16, 2026.

Transparency log

Release files / gmail_sdk_ldraney-0.1.3-py3-none-any.whl

Download URL gmail_sdk_ldraney-0.1.3-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28f05437930a21c34ef9808d1edc26b04282a463246713375646ae4569a7ffd3
BLAKE2b-256 checksum
How to use checksums
7b0c7fb424dd7b36b270bc3be5fc5f026d2467d865ec5b7997855eb8c96119ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

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