Skip to content

Commit

Permalink
dont allow redirects for sonarr/radarr requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
l3uddz committed Jun 6, 2018
1 parent 68f618d commit 739b34a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions media/pvr.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def validate_api_key(self):
req = requests.get(
os.path.join(misc_str.ensure_endswith(self.server_url, "/"), 'api/system/status'),
headers=self.headers,
timeout=60
timeout=60,
allow_redirects=False
)
log.debug("Request Response: %d", req.status_code)

Expand All @@ -49,7 +50,8 @@ def _get_objects(self, endpoint):
req = requests.get(
os.path.join(misc_str.ensure_endswith(self.server_url, "/"), endpoint),
headers=self.headers,
timeout=60
timeout=60,
allow_redirects=False
)
log.debug("Request URL: %s", req.url)
log.debug("Request Response: %d", req.status_code)
Expand All @@ -71,7 +73,8 @@ def get_profile_id(self, profile_name):
req = requests.get(
os.path.join(misc_str.ensure_endswith(self.server_url, "/"), 'api/profile'),
headers=self.headers,
timeout=60
timeout=60,
allow_redirects=False
)
log.debug("Request URL: %s", req.url)
log.debug("Request Response: %d", req.status_code)
Expand Down Expand Up @@ -111,7 +114,8 @@ def _add_object(self, endpoint, payload, identifier_field, identifier):
os.path.join(misc_str.ensure_endswith(self.server_url, "/"), endpoint),
headers=self.headers,
json=payload,
timeout=60
timeout=60,
allow_redirects=False
)
log.debug("Request URL: %s", req.url)
log.debug("Request Payload: %s", payload)
Expand Down
3 changes: 2 additions & 1 deletion media/sonarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def get_tags(self):
req = requests.get(
os.path.join(misc_str.ensure_endswith(self.server_url, "/"), 'api/tag'),
headers=self.headers,
timeout=60
timeout=60,
allow_redirects=False
)
log.debug("Request URL: %s", req.url)
log.debug("Request Response: %d", req.status_code)
Expand Down

0 comments on commit 739b34a

Please sign in to comment.