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 withsecrets_dir=orGMAIL_SECRETS_DIRenv var) - Credentials file:
{secrets_dir}/credentials.json - Token files:
{secrets_dir}/gmail-{account}.json
Metadata
Release files for ldraney-gmail-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ldraney_gmail_sdk-0.1.0.tar.gz | 18.5 kB | Without provenance | Details for ldraney_gmail_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ldraney_gmail_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ldraney_gmail_sdk-0.1.0-py3-none-any.whl |
Total release size: 36.2 kB
Release files / ldraney_gmail_sdk-0.1.0.tar.gz
| Download URL | ldraney_gmail_sdk-0.1.0.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f450945804105b3d91e6b18911e511f25336a44a5eaa3d3157928fb19e341ff
|
|
BLAKE2b-256 checksum How to use checksums |
4816fe41bd3e87e591e4f28b30ed6c09ff57c5616c067fe21f7314f1ddd48df4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / ldraney_gmail_sdk-0.1.0-py3-none-any.whl
| Download URL | ldraney_gmail_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4defcaaa223d7dda8ab83f026a2138461a159a60905e623a5a7e20f9d72f7736
|
|
BLAKE2b-256 checksum How to use checksums |
4fbacad1996ac18aa46c02c42220c988207018f78722fb042a3676d81734c5c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for ldraney-gmail-sdk 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.
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.