Write the image content

main2
Bob Mottram 2019-09-14 19:27:49 +01:00
parent 1be37a84d2
commit 4815caeddc
1 changed files with 2 additions and 3 deletions

View File

@ -61,11 +61,10 @@ def updateAvatarImageCache(session,baseDir: str,httpPrefix: str,actor: str,avata
return None
if not os.path.isfile(avatarImageFilename) or force:
try:
print('avatar image url: '+avatarUrl)
result=session.get(avatarUrl, headers=sessionHeaders, params=None)
with open(avatarImageFilename, 'wb') as f:
f.write(result.raw)
#result.raw.decode_content = True
#copyfileobj(result.raw, f)
f.write(result.content)
print('avatar image downloaded for '+actor)
return avatarImageFilename.replace(baseDir+'/cache','')
except Exception as e: