From 342284173bae9c776e3e75642a903324ead3bd92 Mon Sep 17 00:00:00 2001 From: Landon Abney Date: Sat, 16 Jun 2018 22:24:48 -0700 Subject: [PATCH] Use the same session for all requests Use the Session created at the start of the script for all requests, instead of creating a new one for some of them (which doesn't inherit the settings set on it at the start). --- killstream/kill_stream.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/killstream/kill_stream.py b/killstream/kill_stream.py index fa38144..a7ee28d 100644 --- a/killstream/kill_stream.py +++ b/killstream/kill_stream.py @@ -86,7 +86,7 @@ def send_notification(subject_text, body_text, notifier_id): 'body': body_text} try: - r = requests.post(TAUTULLI_URL.rstrip('/') + '/api/v2', params=payload) + r = sess.post(TAUTULLI_URL.rstrip('/') + '/api/v2', params=payload) response = r.json() if response['response']['result'] == 'success': @@ -111,8 +111,7 @@ def get_activity(): 'cmd': 'get_activity'} try: - req = requests.get(TAUTULLI_URL.rstrip('/') + '/api/v2', - params=payload) + req = sess.get(TAUTULLI_URL.rstrip('/') + '/api/v2', params=payload) response = req.json() res_data = response['response']['data']['sessions']