使用pythondjang将图像上传到gravatar

2024-06-17 10:00:26 发布

您现在位置:Python中文网/ 问答频道 /正文

有没有办法用pythondjango上传https://secure.gravatar.com/中的gravatar图像? 我对python和 我把这个链接作为文档https://en.gravatar.com/site/implement/xmlrpc/。但我无法找到进程在python中如何工作,以及实现需要什么类型的键。你知道吗

任何帮助都将不胜感激。你知道吗


Tags: 文档https图像com类型进程链接site
1条回答
网友
1楼 · 发布于 2024-06-17 10:00:26

为此,请使用xmlrpc python客户端。你知道吗

关于(python 3)的内容:

proxy = xmlrpc.client.ServerProxy('https://secure.gravatar.com/xmlrpc?user=[email_hash]')
try:
    with open("new_grav_img", "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read())
        proxy.grav.saveData(base64img, rating, password)
except xmlrpc.client.ProtocolError as err:
    print("A protocol error occurred")
    print("URL: %s" % err.url)
    print("HTTP/HTTPS headers: %s" % err.headers)
    print("Error code: %d" % err.errcode)
    print("Error message: %s" % err.errmsg)

相关问题 更多 >