Last active
September 1, 2022 20:46
-
-
Save zone13/947e9eea96294a6e070b630378349e70 to your computer and use it in GitHub Desktop.
Python script to post an alert tweet when motion is detected by MotionEyeOS
This file contains 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 post a tweet when motion is detected by MotionEyeOS | |
### run 'sudo pip install python-twitter' before execution | |
### Author: Sid | |
### https://zone13.io | |
### Version 1.0 | |
########################################################################## | |
import twitter, time | |
# 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()) | |
status = "Alert !! Motion detected at " + t | |
# Tweet motion detection alert | |
status = api.PostUpdate(status) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment