mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Fix User-Agent for the xmlrpc.client, and catch KeyboardInterrupt for the standalone xmlrpc.server.
This commit is contained in:
parent
2b6403e5d1
commit
75861df9ab
3 changed files with 14 additions and 5 deletions
|
@ -956,8 +956,13 @@ class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler,
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print('Running XML-RPC server on port 8000')
|
||||
server = SimpleXMLRPCServer(("localhost", 8000))
|
||||
server.register_function(pow)
|
||||
server.register_function(lambda x,y: x+y, 'add')
|
||||
server.serve_forever()
|
||||
print('Serving XML-RPC on localhost port 8000')
|
||||
try:
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print("\nKeyboard interrupt received, exiting.")
|
||||
server.server_close()
|
||||
sys.exit(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue