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 return None
if not os.path.isfile(avatarImageFilename) or force: if not os.path.isfile(avatarImageFilename) or force:
try: try:
print('avatar image url: '+avatarUrl)
result=session.get(avatarUrl, headers=sessionHeaders, params=None) result=session.get(avatarUrl, headers=sessionHeaders, params=None)
with open(avatarImageFilename, 'wb') as f: with open(avatarImageFilename, 'wb') as f:
f.write(result.raw) f.write(result.content)
#result.raw.decode_content = True
#copyfileobj(result.raw, f)
print('avatar image downloaded for '+actor) print('avatar image downloaded for '+actor)
return avatarImageFilename.replace(baseDir+'/cache','') return avatarImageFilename.replace(baseDir+'/cache','')
except Exception as e: except Exception as e: