summaryrefslogtreecommitdiffstats
path: root/Demo
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2006-06-03 23:46:36 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2006-06-03 23:46:36 (GMT)
commit65ff561b50c8f145bd5af3f462b834d820dc4db2 (patch)
tree769f4d49fb5eb56ce67ed4dfed44443c810698df /Demo
parent7b1ddca380158f2217824bacf30a5e90a90c6696 (diff)
downloadcpython-65ff561b50c8f145bd5af3f462b834d820dc4db2.zip
cpython-65ff561b50c8f145bd5af3f462b834d820dc4db2.tar.gz
cpython-65ff561b50c8f145bd5af3f462b834d820dc4db2.tar.bz2
Remove xmlrpc demo -- it duplicates the SimpleXMLRPCServer module.
Diffstat (limited to 'Demo')
-rw-r--r--Demo/xmlrpc/xmlrpcserver.py75
1 files changed, 0 insertions, 75 deletions
diff --git a/Demo/xmlrpc/xmlrpcserver.py b/Demo/xmlrpc/xmlrpcserver.py
deleted file mode 100644
index 7af73be..0000000
--- a/Demo/xmlrpc/xmlrpcserver.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# XML-RPC SERVER
-# $Id$
-#
-# a simple XML-RPC server for Python
-#
-# History:
-# 1999-02-01 fl added to xmlrpclib distribution
-#
-# written by Fredrik Lundh, January 1999.
-#
-# Copyright (c) 1999 by Secret Labs AB.
-# Copyright (c) 1999 by Fredrik Lundh.
-#
-# fredrik@pythonware.com
-# http://www.pythonware.com
-#
-# --------------------------------------------------------------------
-# Permission to use, copy, modify, and distribute this software and
-# its associated documentation for any purpose and without fee is
-# hereby granted. This software is provided as is.
-# --------------------------------------------------------------------
-#
-
-import SocketServer, BaseHTTPServer
-import xmlrpclib
-import sys
-
-class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
-
- def do_POST(self):
- try:
- # get arguments
- data = self.rfile.read(int(self.headers["content-length"]))
- params, method = xmlrpclib.loads(data)
-
- # generate response
- try:
- response = self.call(method, params)
- # wrap response in a singleton tuple
- response = (response,)
- except:
- # report exception back to server
- response = xmlrpclib.dumps(
- xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2])
- )
- else:
- response = xmlrpclib.dumps(
- response,
- methodresponse=1
- )
- except:
- # internal error, report as HTTP server error
- self.send_response(500)
- self.end_headers()
- else:
- # got a valid XML RPC response
- self.send_response(200)
- self.send_header("Content-type", "text/xml")
- self.send_header("Content-length", str(len(response)))
- self.end_headers()
- self.wfile.write(response)
-
- # shut down the connection (from Skip Montanaro)
- self.wfile.flush()
- self.connection.shutdown(1)
-
- def call(self, method, params):
- # override this method to implement RPC methods
- print "CALL", method, params
- return params
-
-if __name__ == '__main__':
- server = SocketServer.TCPServer(('', 8000), RequestHandler)
- server.serve_forever()