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):
client = anki.sync.AnkiRequestsClient()
client.timeout = setting('webTimeout') / 1000
resp = client.get(url)
if resp.status_code == 200:
return client.streamContent(resp)
else:
if resp.status_code != 200:
raise Exception('{} download failed with return code {}'.format(url, resp.status_code))
client.streamContent(resp)
def api(*versions):
def decorator(func):