[Fixed]-Upload image into gravatar using python django

1👍

Use the xmlrpc python client for this.

Something on the lines of (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)

Leave a comment