A stupid gadget to plot the number of messages in your gmail inbox to plot.ly.
git clone https://github.com/tdsmith/gmail-plotly.git
mkdir -p ~/.config/gmail-plotly
(or changeCONFIG_DIR
)- Set up a project in the Google Developer's Console.
- In the APIs & auth section on the left, choose APIs, and switch on the Gmail API.
- In the sidebar on the left, select Credentials and expand the OAuth 2.0
Client ID section. Choose "desktop app" and download the client secret
JSON that's generated to
CONFIG_DIR/google_client_secret.json
. - Visit your plot.ly settings and copy-paste the API Key on the "Profile" tab
into
CONFIG_DIR/plotly_key
. echo your_plotly_username > CONFIG_DIR/plotly_username
- If you would like to make your graph public so that you can embed it in
webpages and other silliness,
touch CONFIG_DIR/plotly_make_public
. - From the gmail-plotly root,
virtualenv .
and activate with. bin/activate
pip install -r requirements.txt
- Set up your Google credentials by running
./gmail-plotly.py --noauth_local_webserver
and following the directions. This will also add the first data point to your plot.ly graph. The URL will be printed at the end. - Add gmail-plotly to your crontab by having it run
run-external.sh
, which takes care of setting up the virtualenv. Or just rungmail-plotly.py
whenever you want to update. Note that it's chatty right now and you may want to pipe stdout to /dev/null.
And now you have one of these. You can embed them in other pages as an iframe.
If you want to generate images locally for hotlinking, you can do that with
plotly.image.save_as
, probably.