missing function

main2
Bob Mottram 2019-09-14 19:17:09 +01:00
parent 7e4982e165
commit 1be37a84d2
1 changed files with 4 additions and 2 deletions

View File

@ -41,6 +41,7 @@ from content import getMentionsFromHtml
from config import getConfigParam from config import getConfigParam
from skills import getSkills from skills import getSkills
from cache import getPersonFromCache from cache import getPersonFromCache
from cache import storePersonInCache
def updateAvatarImageCache(session,baseDir: str,httpPrefix: str,actor: str,avatarUrl: str,personCache: {},force=False) -> str: def updateAvatarImageCache(session,baseDir: str,httpPrefix: str,actor: str,avatarUrl: str,personCache: {},force=False) -> str:
"""Updates the cached avatar for the given actor """Updates the cached avatar for the given actor
@ -62,8 +63,9 @@ def updateAvatarImageCache(session,baseDir: str,httpPrefix: str,actor: str,avata
try: try:
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:
result.raw.decode_content = True f.write(result.raw)
copyfileobj(result.raw, f) #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: