Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c5e715

Browse files
committed
Fix errors in XML-RPC client example code
* http.client.HTTP (does not exist in Python 3) → HTTPConnection * Server (deprecated) → ServerProxy * Transport.send_request() grew a new “debug” parameter in Python 3 (revision a528f7f8f97a)
1 parent 0334c3c commit 1c5e715

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Doc/library/xmlrpc.client.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ Example of Client Usage
541541
except Error as v:
542542
print("ERROR", v)
543543

544-
To access an XML-RPC server through a proxy, you need to define a custom
544+
To access an XML-RPC server through a HTTP proxy, you need to define a custom
545545
transport. The following example shows how:
546546

547547
.. Example taken from http://lowlife.jp/nobonobo/wiki/xmlrpcwithproxy.html
@@ -555,16 +555,16 @@ transport. The following example shows how:
555555
self.proxy = proxy
556556
def make_connection(self, host):
557557
self.realhost = host
558-
h = http.client.HTTP(self.proxy)
558+
h = http.client.HTTPConnection(self.proxy)
559559
return h
560-
def send_request(self, connection, handler, request_body):
560+
def send_request(self, connection, handler, request_body, debug):
561561
connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler))
562562
def send_host(self, connection, host):
563563
connection.putheader('Host', self.realhost)
564564

565565
p = ProxiedTransport()
566566
p.set_proxy('proxy-server:8080')
567-
server = xmlrpc.client.Server('http://time.xmlrpc.com/RPC2', transport=p)
567+
server = xmlrpc.client.ServerProxy('http://time.xmlrpc.com/RPC2', transport=p)
568568
print(server.currentTime.getCurrentTime())
569569

570570

0 commit comments

Comments
 (0)