From 686a716b42ca170f70dfc29f00cf37b84c487634 Mon Sep 17 00:00:00 2001 From: 12nick12 Date: Wed, 6 Feb 2019 19:40:54 -0500 Subject: [PATCH] Update plexpy_sc.py --- plexpy_sc.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plexpy_sc.py b/plexpy_sc.py index 71830f5..a4f2bc5 100644 --- a/plexpy_sc.py +++ b/plexpy_sc.py @@ -1,14 +1,18 @@ -#!/usr/bin/env python # This reports the stream count +#!/usr/bin/env python import json import requests import math -host = '' -api_key = '' -url_base = 'not included slashes' -ssl = 'true/false' +f = open("/home/hass/.homeassistant/python_scripts/plexpy/.creds", "r") +data = f.read().splitlines() +f.close() + +host = data[4] +api_key = data[5] +url_base = data[6] +ssl = data[7] if ssl == 'true': http = 'https' @@ -17,9 +21,7 @@ if ssl == 'false': url = http + "://" + host + "/" + url_base + "/api/v2?apikey=" + api_key + "&cmd=get_activity" -requests.packages.urllib3.disable_warnings() - -response = requests.get(url, verify=False) +response = requests.get(url) json_input = response.text