Fixed library downloading invalid images

This commit is contained in:
RemixDev 2020-05-30 18:49:41 +02:00
parent 517101d81e
commit 76427aea20
1 changed files with 1 additions and 0 deletions

View File

@ -90,6 +90,7 @@ def downloadImage(url, path, overwrite="n"):
if not os.path.isfile(path) or overwrite in ['y', 't']: if not os.path.isfile(path) or overwrite in ['y', 't']:
try: try:
image = get(url, headers={'User-Agent': USER_AGENT_HEADER}, timeout=30) image = get(url, headers={'User-Agent': USER_AGENT_HEADER}, timeout=30)
image.raise_for_status()
with open(path, 'wb') as f: with open(path, 'wb') as f:
f.write(image.content) f.write(image.content)
return path return path