-
-
Save hemanth22/21b003a20163803eb287a6cc1e3188ad to your computer and use it in GitHub Desktop.
Send an IFTTT notification for a specific username
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
### WARNING: This script has not been tested! ### | |
# 1. Install the requests module for python. | |
# pip install requests | |
# 2. Add script arguments in PlexPy. | |
# {user} {action} | |
import requests | |
import sys | |
user = sys.argv[1] | |
action = sys.argv[2] | |
## EDIT THESE SETTINGS ## | |
PLEXPY_URL = 'http://localhost:8181/' # Your PlexPy URL | |
PLEXPY_APIKEY = '#####' # Enter your PlexPy API Key | |
AGENT_ID = 12 # The PlexPy notifier agent id found here: https://github.com/drzoidberg33/plexpy/blob/master/plexpy/notifiers.py#L43 | |
NOTIFY_SUBJECT = 'PlexPy' # The notification subject | |
NOTIFY_BODY = 'Some body text' # The notification body | |
USERNAME = 'MyUsername' # Your username to filter out | |
## CODE BELOW ## | |
# Check if the username matches | |
if user == USERNAME: | |
# Send notification to PlexPy using the API | |
payload = {'apikey': PLEXPY_APIKEY, | |
'cmd': 'notify', | |
'agent_id': AGENT_ID, | |
'subject': NOTIFY_SUBJECT, | |
'body': NOTIFY_BODY, | |
'notify_action': action.lower()} | |
r = requests.post(PLEXPY_URL.rstrip('/') + '/api/v2', params=payload) | |
else: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment