[Python-checkins] cpython (2.7): Fix errors in XML-RPC client example code
martin.panter
python-checkins at python.org
Mon Feb 22 04:16:31 EST 2016
https://hg.python.org/cpython/rev/39b6fad0e7bf
changeset: 100292:39b6fad0e7bf
branch: 2.7
parent: 100274:ada8023878d0
user: Martin Panter <vadmium+py at gmail.com>
date: Mon Feb 22 09:10:54 2016 +0000
summary:
Fix errors in XML-RPC client example code
* httplib.HTTP (deprecated and does not work) → HTTPConnection
* Server (deprecated) → ServerProxy
files:
Doc/library/xmlrpclib.rst | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Doc/library/xmlrpclib.rst b/Doc/library/xmlrpclib.rst
--- a/Doc/library/xmlrpclib.rst
+++ b/Doc/library/xmlrpclib.rst
@@ -564,7 +564,7 @@
except Error as v:
print "ERROR", v
-To access an XML-RPC server through a proxy, you need to define a custom
+To access an XML-RPC server through a HTTP proxy, you need to define a custom
transport. The following example shows how:
.. Example taken from http://lowlife.jp/nobonobo/wiki/xmlrpcwithproxy.html
@@ -578,7 +578,7 @@
self.proxy = proxy
def make_connection(self, host):
self.realhost = host
- h = httplib.HTTP(self.proxy)
+ h = httplib.HTTPConnection(self.proxy)
return h
def send_request(self, connection, handler, request_body):
connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler))
@@ -587,7 +587,7 @@
p = ProxiedTransport()
p.set_proxy('proxy-server:8080')
- server = xmlrpclib.Server('http://time.xmlrpc.com/RPC2', transport=p)
+ server = xmlrpclib.ServerProxy('http://time.xmlrpc.com/RPC2', transport=p)
print server.currentTime.getCurrentTime()
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list