forked from indymedia/epicyon
Write the image content
parent
1be37a84d2
commit
4815caeddc
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue