Browse Source

Merge branch 'feature/ChangeRetryGhFetch' into develop

tags/release_0.25.1
JackDandy 5 years ago
parent
commit
052d2bd7e6
  1. 1
      CHANGES.md
  2. 18
      lib/sg_helpers.py

1
CHANGES.md

@ -68,6 +68,7 @@
* Change remove old provider dupe cleanup
* Change add response rate limit handling for generic providers
* Change add newznab retry handling
* Change add 2s interval fetch retry for Github as it can sometimes return no data
[develop changelog]

18
lib/sg_helpers.py

@ -846,13 +846,19 @@ def get_url(url, # type: AnyStr
response = session.post(url, timeout=timeout, **kwargs)
else:
response = session.get(url, timeout=timeout, **kwargs)
if response.ok and not response.content and 'url=' in response.headers.get('Refresh', '').lower():
url = response.headers.get('Refresh').lower().split('url=')[1].strip('/')
if not url.startswith('http'):
parsed[2] = '/%s' % url
url = urlunparse(parsed)
for r in range(0, 5):
response = session.get(url, timeout=timeout, **kwargs)
if response.ok and not response.content:
if 'url=' in response.headers.get('Refresh', '').lower():
url = response.headers.get('Refresh').lower().split('url=')[1].strip('/')
if not url.startswith('http'):
parsed[2] = '/%s' % url
url = urlunparse(parsed)
response = session.get(url, timeout=timeout, **kwargs)
elif 'github' in url:
time.sleep(2)
continue
break
# if encoding is not in header try to use best guess
# ignore downloads with savename

Loading…
Cancel
Save