1👍
✅
Use the xmlrpc python client for this.
- Python 2.7: https://docs.python.org/2/library/xmlrpclib.html
- Python 3: https://docs.python.org/3/library/xmlrpc.client.html
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)
Source:stackexchange.com