标签:hashlib http info encode 邮箱 code inf for res
- 注册账号,上传头像
- https://secure.gravatar.com/avatar/<邮箱的md5> 就可以获取到头像
def gravatar(self, size=100, default=‘identicon‘, rating=‘g‘):
url = ‘https://secure.gravatar.com/avatar‘
hash = hashlib.md5(self.email.lower().encode(‘utf-8‘)).hexdigest()
return ‘{url}/{hash}?s={size}&d={default}&r={rating}‘.format(
url=url, hash=hash, size=size, default=default, rating=rating)
标签:hashlib http info encode 邮箱 code inf for res
原文地址:https://www.cnblogs.com/allen2333/p/9095248.html