mail_connector
Gmail connector for Python — read, modify, and organize emails via OAuth2.
Installation
pip install mes-courriels
Setup
- Create a Google Cloud project and enable the Gmail API
- Create an OAuth2 Client ID (type Desktop)
- Copy
.env.exampleto.envand fill inGMAIL_CLIENT_IDandGMAIL_CLIENT_SECRET - Run the auth script to get a refresh token:
uv run python scripts/auth.py
Usage
from mail_connector import GmailConnector
gmail = GmailConnector()
gmail.list_labels()
gmail.list_messages(query="from:alice@example.com")
gmail.get_message("msg_id")
gmail.mark_as_read("msg_id")
gmail.mark_as_unread("msg_id")
gmail.archive("msg_id")
gmail.trash("msg_id")
gmail.modify_message("msg_id", add_label_ids=["STARRED"])
gmail.send_message("to@example.com", "Subject", "Body text")
CLI
mes-courriels alice@example.com # 10 derniers messages
mes-courriels alice@example.com -n 3 # les 3 derniers
mes-courriels alice@example.com -w # surveiller en continu (60s)
mes-courriels alice@example.com -w -i 30 # surveiller toutes les 30s
Development
- Python >= 3.12, uv
uv sync
uv run pytest
Metadata
Release files for mes-courriels 0.0.7
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 |
|---|---|---|---|---|
| mes_courriels-0.0.7.tar.gz | 10.7 kB | Without provenance | Details for mes_courriels-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mes_courriels-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for mes_courriels-0.0.7-py3-none-any.whl |
Total release size: 17.5 kB
Release files / mes_courriels-0.0.7.tar.gz
| Download URL | mes_courriels-0.0.7.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
126e9d7bcfe4dadb851c46469d6d3fad4366bdc72578b4042a23798e449eef65
|
|
BLAKE2b-256 checksum How to use checksums |
c4e9f58db3f92759a6aadbeb52164659b767acf0caea29ed4363a87a478d0d4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / mes_courriels-0.0.7-py3-none-any.whl
| Download URL | mes_courriels-0.0.7-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
640b08ad7430a9267b668c73a1e2758054c4dc87a3779fda101b08dcc98134ef
|
|
BLAKE2b-256 checksum How to use checksums |
7981e13014f82cf598b29856177bf546cc40cc17e6f31088cedeaae42550a90c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for mes-courriels 0.0.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.
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.