diff options
Diffstat (limited to 'Doc/library/xmlrpc.client.rst')
-rw-r--r-- | Doc/library/xmlrpc.client.rst | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst index 0edf010..f66a230 100644 --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -216,7 +216,7 @@ A working example follows. The server code:: from xmlrpc.server import SimpleXMLRPCServer def is_even(n): - return n%2 == 0 + return n % 2 == 0 server = SimpleXMLRPCServer(("localhost", 8000)) print("Listening on port 8000...") @@ -373,7 +373,7 @@ returning a complex type object. The server code:: # A marshalling error is going to occur because we're returning a # complex number - def add(x,y): + def add(x, y): return x+y+0j server = SimpleXMLRPCServer(("localhost", 8000)) @@ -566,12 +566,15 @@ transport. The following example shows how: class ProxiedTransport(xmlrpc.client.Transport): def set_proxy(self, proxy): self.proxy = proxy + def make_connection(self, host): self.realhost = host h = http.client.HTTPConnection(self.proxy) return h + def send_request(self, connection, handler, request_body, debug): connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler)) + def send_host(self, connection, host): connection.putheader('Host', self.realhost) |