2017-02-16 59 views

回答

1

爲此使用xmlrpc python客戶端。

  • 的Python 2.7:https://docs.python.org/2/library/xmlrpclib.html
  • 的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) 
    
    https://docs.python.org/3/library/xmlrpc.client.html

上(蟒3)的東西線