summaryrefslogtreecommitdiffstats
path: root/Doc/library/xmlrpclib.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-02-01 11:56:49 (GMT)
committerGeorg Brandl <georg@python.org>2008-02-01 11:56:49 (GMT)
commitf69451833191454bfef75804c2654dc37e8f3e93 (patch)
tree7e81560f5276c35f68b7b02e75feb9221a82ae5d /Doc/library/xmlrpclib.rst
parentf25ef50549d9f2bcb6294fe61a9902490728edcc (diff)
downloadcpython-f69451833191454bfef75804c2654dc37e8f3e93.zip
cpython-f69451833191454bfef75804c2654dc37e8f3e93.tar.gz
cpython-f69451833191454bfef75804c2654dc37e8f3e93.tar.bz2
Update docs w.r.t. PEP 3100 changes -- patch for GHOP by Dan Finnie.
Diffstat (limited to 'Doc/library/xmlrpclib.rst')
-rw-r--r--Doc/library/xmlrpclib.rst34
1 files changed, 17 insertions, 17 deletions
diff --git a/Doc/library/xmlrpclib.rst b/Doc/library/xmlrpclib.rst
index 82ce1da..dd06c0a 100644
--- a/Doc/library/xmlrpclib.rst
+++ b/Doc/library/xmlrpclib.rst
@@ -194,7 +194,7 @@ A working example follows. The server code::
return n%2 == 0
server = SimpleXMLRPCServer(("localhost", 8000))
- print "Listening on port 8000..."
+ print("Listening on port 8000...")
server.register_function(is_even, "is_even")
server.serve_forever()
@@ -203,8 +203,8 @@ The client code for the preceding server::
import xmlrpclib
proxy = xmlrpclib.ServerProxy("http://localhost:8000/")
- print "3 is even: %s" % str(proxy.is_even(3))
- print "100 is even: %s" % str(proxy.is_even(100))
+ print("3 is even: %s" % str(proxy.is_even(3)))
+ print("100 is even: %s" % str(proxy.is_even(100)))
.. _datetime-objects:
@@ -241,7 +241,7 @@ A working example follows. The server code::
return xmlrpclib.DateTime(today)
server = SimpleXMLRPCServer(("localhost", 8000))
- print "Listening on port 8000..."
+ print("Listening on port 8000...")
server.register_function(today, "today")
server.serve_forever()
@@ -255,7 +255,7 @@ The client code for the preceding server::
today = proxy.today()
# convert the ISO8601 string to a datetime object
converted = datetime.datetime.strptime(today.value, "%Y%m%dT%H:%M:%S")
- print "Today: %s" % converted.strftime("%d.%m.%Y, %H:%M")
+ print("Today: %s" % converted.strftime("%d.%m.%Y, %H:%M"))
.. _binary-objects:
@@ -300,7 +300,7 @@ XMLRPC::
handle.close()
server = SimpleXMLRPCServer(("localhost", 8000))
- print "Listening on port 8000..."
+ print("Listening on port 8000...")
server.register_function(python_logo, 'python_logo')
server.serve_forever()
@@ -343,7 +343,7 @@ returning a complex type object. The server code::
return x+y+0j
server = SimpleXMLRPCServer(("localhost", 8000))
- print "Listening on port 8000..."
+ print("Listening on port 8000...")
server.register_function(add, 'add')
server.serve_forever()
@@ -356,9 +356,9 @@ The client code for the preceding server::
try:
proxy.add(2, 5)
except xmlrpclib.Fault, err:
- print "A fault occured"
- print "Fault code: %d" % err.faultCode
- print "Fault string: %s" % err.faultString
+ print("A fault occured")
+ print("Fault code: %d" % err.faultCode)
+ print("Fault string: %s" % err.faultString)
@@ -403,11 +403,11 @@ by providing an invalid URI::
try:
proxy.some_method()
except xmlrpclib.ProtocolError, err:
- print "A protocol error occured"
- print "URL: %s" % err.url
- print "HTTP/HTTPS headers: %s" % err.headers
- print "Error code: %d" % err.errcode
- print "Error message: %s" % err.errmsg
+ print("A protocol error occured")
+ print("URL: %s" % err.url)
+ print("HTTP/HTTPS headers: %s" % err.headers)
+ print("Error code: %d" % err.errcode)
+ print("Error message: %s" % err.errmsg)
MultiCall Objects
-----------------
@@ -444,7 +444,7 @@ A usage example of this class follows. The server code ::
# A simple server with simple arithmetic functions
server = SimpleXMLRPCServer(("localhost", 8000))
- print "Listening on port 8000..."
+ print("Listening on port 8000...")
server.register_multicall_functions()
server.register_function(add, 'add')
server.register_function(subtract, 'subtract')
@@ -464,7 +464,7 @@ The client code for the preceding server::
multicall.divide(7,3)
result = multicall()
- print "7+3=%d, 7-3=%d, 7*3=%d, 7/3=%d" % tuple(result)
+ print("7+3=%d, 7-3=%d, 7*3=%d, 7/3=%d" % tuple(result))
Convenience Functions