Python 图像请求

# import code for encoding urls and generating md5 hashes
import urllib, hashlib
 
# Set your variables here
email = "someone@somewhere.com"
default = "https://www.example.com/default.jpg"
size = 40
 
# construct the url
cravatar_url = "https://cn.cravatar.com/avatar/" + hashlib.md5(email.lower()).hexdigest() + "?"
cravatar_url += urllib.urlencode({'d':default, 's':str(size)})

如果您使用 Python 3,请尝试 libgravatar (调整为 libcravatar 即可)。这是第三方库,不受 Cravatar 官方支持。


版本号 #3
由 壳壳虫 创建于 2023-08-15 03:35:51 UTC
由 壳壳虫 更新于 2023-08-15 04:08:27 UTC