Created
March 27, 2017 22:19
-
-
Save zone13/308d5b39f9f968e21041a53cc9644d22 to your computer and use it in GitHub Desktop.
Python script to send a Direct message when motion is detected by MotionEyeOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
########################################################################## | |
### Python Script to send a Direct Message to your official Twitter handle | |
### run 'sudo pip install python-twitter' before execution | |
### Author: Sid | |
### https://zone13.io | |
### Version 1.0 | |
########################################################################## | |
import twitter, time | |
# Populate your official Twitter handle below | |
twitter_handle = '' | |
# Populate the Twitter API keys below | |
consumer_key = '' | |
consumer_secret = '' | |
access_token_key = '' | |
access_token_secret = '' | |
api = twitter.Api( | |
consumer_key=consumer_key, | |
consumer_secret=consumer_secret, | |
access_token_key=access_token_key, | |
access_token_secret=access_token_secret) | |
# Get current time | |
t = time.strftime("%d-%m-%Y %H:%M:%S", time.gmtime()) | |
msg = "Alert !! Motion detected at " + t | |
# Send Direct Message to official Twitter handle | |
send_msg = api.PostDirectMessage(msg, user_id=None, screen_name=twitter_handle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment