Skip to content

Instantly share code, notes, and snippets.

@JonnyWong16
Created January 15, 2018 22:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JonnyWong16/8386ad30e8af5e25a9f2b883823a2bc1 to your computer and use it in GitHub Desktop.
Save JonnyWong16/8386ad30e8af5e25a9f2b883823a2bc1 to your computer and use it in GitHub Desktop.
Kill a Plex stream
import requests
import sys
PLEXPY_URL = 'http://localhost:8181'
APIKEY = 'xxxxxxxxxx'
MESSAGE = 'Your stream was terminated for "reasons"'
session_id = sys.argv[1]
payload = {'apikey': APIKEY,
'cmd': 'terminate_session',
'session_id': session_id,
'message': MESSAGE}
r = requests.post(PLEXPY_URL.rstrip('/') + '/api/v2', params=payload}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment