Skip to main content

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

EmailBot is on pip, just run

pip install emailbot

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SimpleEmailBot-0.0.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

SimpleEmailBot-0.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file SimpleEmailBot-0.0.0.tar.gz.

File metadata

  • Download URL: SimpleEmailBot-0.0.0.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

Hashes for SimpleEmailBot-0.0.0.tar.gz
Algorithm Hash digest
SHA256 f2234af32e344d365b77e50dbaeb5b1131c699c1c2aacde442acb912e926543a
MD5 23680e93d084c41e72d7954b7872b9a9
BLAKE2b-256 3899d357e0a296739dee3082ff69aa826621b9c174caac4f8bbcfd798e242006

See more details on using hashes here.

File details

Details for the file SimpleEmailBot-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: SimpleEmailBot-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 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

Hashes for SimpleEmailBot-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf61ace00a13eb51be33a8b9b987730a45f01504d1cfb66caca17c402b784ea2
MD5 841f337a8e946fa552744302c15109f4
BLAKE2b-256 47f66b48d2bc671a07c114ff43d3fbfa23d8bd4742446aa32636fe5fc29da8c9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page