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).
This commit is contained in:
parent
7b0cc2d2a9
commit
342284173b
@ -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']
|
||||
|
Loading…
Reference in New Issue
Block a user