https://github.com/csteinmetz1/py-alerts

Simple module/wrapper to send alerts from a python script.

https://github.com/csteinmetz1/py-alerts

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Simple module/wrapper to send alerts from a python script.

Basic Info
  • Host: GitHub
  • Owner: csteinmetz1
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 135 KB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 8 years ago · Last pushed over 8 years ago
Metadata Files
Readme

README.md

py-alerts

Simple module/wrapper to send alerts from a python script.

Setup

Get the code. git clone https://github.com/csteinmetz1/py-alerts.git

Install dependenacies. pip install future pip install requests

Built to work with either Python 2 or Python 3.

Email

I reccommend that you create a gmail account just for sending email alerts. Once you have an account tou need to do adjust some settings to send email alerts.

First enable two-factor authentication here for your google alerts account. Next you need to create an app password for your python script to login to your account. You can do that here and you should see a window like this:

app passwords

Now choose Other from the Select app dropdown and set a name the name to py-alerts (or whatever else you would like) then hit generate. You should then be given a password similiar to the one below.

app done

Note: This isn't a valid passcode - just shown for example.

Slack

You now have everything you need to start sending email and slack alerts. To set your credentials in python you need to create a JSON config file that contains the info for the gmail account used to send the alerts as well as set the emails of recipients of the alerts. An example is shown below.

json { "email" : { "gmail_user" : "username@gmail.com", "gmail_pass" : "your_app_passcode", "gmail_name" : "username", "recipients" : ["recipient1@gmail.com", "recipient2@gmail.com"] }, "slack" : { "webhook" : "https://hooks.slack.com/services/YOURWEBHOOKURL" } }

Usage

Sending an email in your script is easy.

``` python from pyalerts import emailalert

emailalertobj = emailalert() myemail_obj.send(subject="This is the subject", message="This is the body of the email")

`` And you should recieve an email shortly after. Ensure that you place thepy_alerts.pyandsettings.json` files in the same directory as the python script you are trying to send emails from.

``` python from pyalerts import slackalert

slackalertobj = slackalert() myslack_obj.send(message="This is the message text.") ```

Owner

  • Name: Christian J. Steinmetz
  • Login: csteinmetz1
  • Kind: user
  • Location: London, UK
  • Company: @aim-qmul

Machine learning for Hi-Fi audio. PhD Researcher at C4DM.

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels