This commit is contained in:
Alex Yatskov 2021-01-18 20:18:57 -08:00
parent abd2fea76f
commit 322984be06

View File

@ -33,12 +33,13 @@ class MediaType(enum.Enum):
def download(url): def download(url):
client = anki.sync.AnkiRequestsClient() client = anki.sync.AnkiRequestsClient()
client.timeout = setting('webTimeout') / 1000 client.timeout = setting('webTimeout') / 1000
resp = client.get(url) resp = client.get(url)
if resp.status_code == 200: if resp.status_code != 200:
return client.streamContent(resp)
else:
raise Exception('{} download failed with return code {}'.format(url, resp.status_code)) raise Exception('{} download failed with return code {}'.format(url, resp.status_code))
client.streamContent(resp)
def api(*versions): def api(*versions):
def decorator(func): def decorator(func):