Commit 942470c2 authored by echel0n's avatar echel0n

Refactored SR-API client to not attempt accessing endpoints if token is not present.

parent d11afb7c
......@@ -145,6 +145,9 @@ class API(object):
def request(self, method, url, timeout=30, **kwargs):
latest_exception = None
if not self.token:
return
for i in range(3):
try:
if not self.health:
......
......@@ -104,12 +104,12 @@ class GenericProvider(object):
@property
def urls(self):
# try:
# resp = sickrage.app.api.provider.get_urls(self.id)
# if resp and 'data' in resp:
# return json.loads(resp['data']['urls'])
# except (JSONDecodeError, APIError) as e:
# pass
try:
resp = sickrage.app.api.provider.get_urls(self.id)
if resp and 'data' in resp:
return json.loads(resp['data']['urls'])
except (JSONDecodeError, APIError) as e:
pass
return self._urls
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment