This script is in development. Right now it can get the top number of senders in a users gmail inbox.
This script requires you to create a Google Cloud Platform Project and enable the Gmail api. The credentials must be saved in a credentials.json file in the project directory.
Create a virtual environment for the project using python 3.9 python -m venv venv
Activate the virtual environment and install dependencies by using pip install -r requirements.txt
with your virtual environment.
Example: Group last 100 emails by top senders and decide which ones to move to trash (not a permanent deletion).
python cleanup.py 100
Fetching 100 emails 100 at a time...
0% (0 of 4) | | Elapsed Time: 0:00:00 ETA: --:--:--View more info on 14 emails from Dan at Real Python <[email protected]>? (y/n)y
subject: last call: Learn Python Effectively
subject: In love, war, and open-source—never give up
subject: Your Roadmap to Clean & Pythonic Code
subject: Real Python Membership Q&A
subject: [🐍PyTricks]: Python's namedtuples can be a great alternative to defining a class manually
subject: No crane kicks at the Python gym
subject: [🐍PyTricks]: The get() method on Python dicts and its "default" arg
subject: how to stay current as a Python developer
subject: [🐍PyTricks]: picking up the basics of Python was the easy part?
subject: Python 4.0
subject: [🐍PyTricks]: How to sort a Python dict by value
subject: [🐍PyTricks]: Different ways to test multiple flags at once in Python
subject: [🐍PyTricks]: Merging two dicts in Python 3.5+ with a single expression
subject: Welcome to the Real Python community!
Delete all 14 emails from Dan at Real Python <[email protected]>? (y/n)n
View more info on 12 emails from "IsThereAnyDeal.com" <[email protected]>? (y/n)y
subject: Waitlist: STAR WARS Jedi: Fallen Order $13
subject: Waitlist: Red Dead Redemption 2 $27
subject: Waitlist x3: Mass Effect Legendary Edition $35, Red Dead Redemption 2 $30, STAR WARS Jedi: Fallen Order $13
subject: Waitlist: STAR WARS Jedi: Fallen Order $13
subject: Waitlist: Red Dead Redemption 2 $27
subject: Waitlist x3: Mass Effect Legendary Edition $29, Red Dead Redemption 2 $27, STAR WARS Jedi: Fallen Order $15
subject: Waitlist: Red Dead Redemption 2 $30
subject: Waitlist: Red Dead Redemption 2 $27
subject: Waitlist: Red Dead Redemption 2 $27
subject: Waitlist x2: Marvel's Avengers $16, Red Dead Redemption 2 $28
subject: Waitlist x2: Mass Effect Legendary Edition $30, STAR WARS Jedi: Fallen Order $13
subject: Waitlist x4: Marvel's Avengers $16, Mass Effect Legendary Edition $31, Red Dead Redemption 2 $27
Delete all 12 emails from "IsThereAnyDeal.com" <[email protected]>? (y/n)n
View more info on 2 emails from [email protected]? (y/n)y
subject: GeeksforGeeks - Please Confirm Registration
subject: Welcome to GeeksforGeeks!
Delete all 2 emails from [email protected]? (y/n)y
- aiofiles by Tin Tvrtkovic
- async-timeout by Andrew Svetlov [email protected]
- asynctest by Martin Richard
- attrs by Hynek Schlawack
- cachetools by Thomas Kemmer
- certifi by Kenneth Reitz
- cfgv by Anthony Sottile
- chardet by Mark Pilgrim
- charset-normalizer by Ahmed TAHRI @Ousret
- click by Armin Ronacher
- colorama by Jonathan Hartley
- distlib by Vinay Sajip
- filelock by Benedikt Schmitt
- google-api-core by Google LLC
- google-api-python-client by Google LLC
- google-auth by Google Cloud Platform
- google-auth-oauthlib by Google Cloud Platform
- googleapis-common-protos by Google LLC
- identify by Chris Kuehl
- idna by Kim Davies
- multidict by Andrew Svetlov
- mypy-extensions by The mypy developers
- nodeenv by Eugene Kalinin
- oauthlib by The OAuthlib Community
- packaging by Donald Stufft and individual contributors
- pathspec by Caleb P. Burns
- pip-check-reqs by Richard Jones
- platformdirs by
- pre-commit by Anthony Sottile
- progressbar by Nilton Volpato
- protobuf by
- pyasn by
- pydantic by Samuel Colvin
- pyparsing by Paul McGuire
- python-utils by Rick van Hattem
- PyYAML by Kirill Simonov
- regex by Matthew Barnett
- requests by Kenneth Reitz
- requests-oauthlib by Kenneth Reitz
- rsa by Sybren A. Stüvel
- six by Benjamin Peterson
- thanker by WardPearce
- toml by William Pearson
- tomli by
- typer by Sebastián Ramírez
- typing-extensions by
- uritemplate by Ian Stapleton Cordasco
- virtualenv by Bernat Gabor
- yarl by Andrew Svetlov