Skip to content

Instantly share code, notes, and snippets.

View jramirez857's full-sized avatar
🎯
Focusing

Jose Ramirez jramirez857

🎯
Focusing
View GitHub Profile
@jramirez857
jramirez857 / gmail.py
Last active September 14, 2022 01:54
Gist for getting top email senders from your most recent n emails. Requires GMail API Project Setup with credentials in a credentials.json file. Usage 1. python -m venv venv 2. `source venv/bin/activate` 3. `pip install -r requirements.txt` 4. `python -m top_senders.py --help`
"""
This module contains the GmailAuth class. It is used to authenticate with
Gmail.
"""
import argparse
import os.path as p
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials