Simple package to email you when scripts are finished.
Project description
SimpleEmailBot
SimpleEmailBot is a very simple Python package to send an email when a script is completed. I use this mainly to let me know when deep learning models have finished training.
Install
SimpleEmailBot is on pip, just run
pip install simpleemailbot
Usage
Bot email
First you need an email for the bot, currently this only works with gmail so make a new gmail account here. You also need to go to settings and set allow less secure apps to ON. Link. Be careful because this makes the account less secure, that's why we want to make a new account. Make sure you are doing this with the new account and not your own gmail also.
Secrets
Now you need to put the username and password in a file somewhere
so that they don't end up in your code. This is done with a file at ~/.emailbot
which is tab separated and contains an identifier, the email address and the password.
e.g.
bot mybot@gmail.com password123
Make sure you use tabs and not spaces.
Also you should run chmod 600 ~/.emailbot
. This
makes sure only you have read and write permissions.
You can change where the secrets are
kept with EmailBot.set_secrets_path()
Code
No more setup to do now, here is an example usage.
from simpleemailbot import EmailBot
# bot is the identifier in the secrets file
# don't put anything that identifies the email or password in your code
bot = EmailBot("myemail@gmail.com", "bot")
bot.email_me()
This sends an email to myemail@gmail with the subject "Task Complete" and the content "Task Complete".
If you want you can change the subject and message:
bot.email_me(subject="Error", message="Oh no something went wrong!")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file SimpleEmailBot-0.0.1.tar.gz
.
File metadata
- Download URL: SimpleEmailBot-0.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f811d05f5fbaf8b0db14fc6ebd3204b00b3b8841224254c33742e33bcd052c6 |
|
MD5 | 7644bea83b1e9e24451d9875b86aad4e |
|
BLAKE2b-256 | 115022d241165ea0e92457616c0a42be2ee82ac7ac618fb3be0419274301c355 |
File details
Details for the file SimpleEmailBot-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: SimpleEmailBot-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e41e58ab1320f545fac9fba513ed285a67d8f9a94b7f768071d90e384446dd07 |
|
MD5 | a7a0f29d05a4589ce17f6d24e4dbf23b |
|
BLAKE2b-256 | b2a503d5e5e34d94d7f371052829e899c97e40978757027348d1f2bf10e8fdcc |