classification
Title: Lib/xmlrpc/client.py demo code points to the dead server
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: orsenthil, python-dev, r.david.murray, vajrasky
Priority: normal Keywords: patch

Created on 2013-09-24 14:48 by vajrasky, last changed 2014-01-13 00:08 by orsenthil. This issue is now closed.

Files
File name Uploaded Description Edit
xmlrpc_server_client_demo.patch vajrasky, 2013-09-24 14:51 review
xmlrpc_server_client_demo_v2.patch vajrasky, 2013-10-12 04:10 review
issue19082-patch3.diff orsenthil, 2013-10-14 00:44 review
Messages (10)
msg198359 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-09-24 14:48
Lib/xmlrpc/client.py tries to connect to http://time.xmlrpc.com/RPC2 which has been dead for a "while". I see there is no light in the end of tunnel. Since this code is meant to be a demo not a general purpose tool, I say why don't we direct it to localhost (which can be provided by Lib/xmlrpc/server.py).

After applying this patch, you can start the server:
$ python Lib/xmlrpc/server.py
Serving XML-RPC on localhost port 8000

Then in another place, you can start the client and get result straight away:
$ python Lib/xmlrpc/client.py
2013-09-24T22:35:27
2013-09-24T22:35:27
512
3

Isn't that beautiful?
msg198361 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-09-24 15:24
Sure :)

If you want some bonus points, can you figure out whether or not the test in test_xmlrpc_net is worth moving to test_xmlrpc using a similar local-server approach, or if it is redundant and should just be deleted?

(time.xmlrcp.com has come and gone multiple times over the years...)
msg198444 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-09-26 14:01
What test_xmlrpc_net tests (especially the one with time.xmlrpc.com) have been tested in test_xmlrpc except for connecting to server with dotted_attribute feature and receiving datetime instance over the network.

That test is not that hard to be migrated to test_xmlrpc. But should we chuck it in this ticket or create a new ticket?

There is also a reference to time.xmlrpc.com in Doc/library/xmlrpc.client.rst.
msg198445 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-09-26 15:53
Yeah, a new issue is probably a good idea.  If the dotted attribute feature is not tested by test_xmlrpc, then the test is probably worth migrating.

I'm not sure what to do about the docs, and that should be a separate issue as well.
msg199536 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-10-12 04:10
Okay, I updated the patch. Now, it sends the datetime object instead of formatted datetime string. Also, I used static method inside instance to let the client uses dotted attribute feature instead of self attribute trick.
msg199828 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-10-14 00:44
The patch is good. I think, it is better to include this information in documentation too. Please let me know if this suitable, I shall go ahead committing this. (With credits to Vajrasky Kok)
msg199860 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-10-14 10:42
Hi, Senthil Kumaran, thank you for your review.

I have one small complain about your improved patch. Perhaps we need to give security warning when they want to use allow_dotted_names feature in the documentation. I omitted the warning in the demo because it is just a demo.

From the source code (Lib/xmlrpc/server.py):
    *** SECURITY WARNING: ***

            Enabling the allow_dotted_names options allows intruders
            to access your module's global variables and may allow
            intruders to execute arbitrary code on your machine.  Only
            use this option on a secure, closed network.

Whether we want to give a separate example without allow_dotted_names feature or using example without allow_dotted_names feature entirely, I am not really sure.

What do you say?
msg199922 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-10-14 16:13
Sounds good.I shall update patch (.rstify the security warning).  Thank you!
msg207988 - (view) Author: Roundup Robot (python-dev) Date: 2014-01-13 00:08
New changeset 1730f4a97cbb by Senthil Kumaran in branch '2.7':
Issue #19082: Working SimpleXMLRPCServer and xmlrpclib examples, both in modules and documentation.
http://hg.python.org/cpython/rev/1730f4a97cbb

New changeset 72560f9bb2a2 by Senthil Kumaran in branch '3.3':
Issue #19082: Working xmlrpc.server and xmlrpc.client examples. Both in modules and in documentation.
http://hg.python.org/cpython/rev/72560f9bb2a2

New changeset bdf6c0135d39 by Senthil Kumaran in branch 'default':
merge from 3.3
http://hg.python.org/cpython/rev/bdf6c0135d39
msg207989 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2014-01-13 00:08
Addressed this in all active branches (2.7, 3.3 and 3.4). Thanks!
History
Date User Action Args
2014-01-13 00:08:57orsenthilsetstatus: open -> closed
resolution: fixed
messages: + msg207989

stage: resolved
2014-01-13 00:08:13python-devsetnosy: + python-dev
messages: + msg207988
2013-10-14 16:13:07orsenthilsetmessages: + msg199922
2013-10-14 10:42:15vajraskysetmessages: + msg199860
2013-10-14 00:44:30orsenthilsetfiles: + issue19082-patch3.diff

nosy: + orsenthil
versions: + Python 3.3
messages: + msg199828

assignee: orsenthil
2013-10-12 04:10:16vajraskysetfiles: + xmlrpc_server_client_demo_v2.patch

messages: + msg199536
2013-09-26 15:53:59r.david.murraysetmessages: + msg198445
2013-09-26 14:01:59vajraskysetmessages: + msg198444
2013-09-24 15:24:54r.david.murraysetnosy: + r.david.murray
messages: + msg198361
2013-09-24 14:51:08vajraskysetfiles: + xmlrpc_server_client_demo.patch
2013-09-24 14:50:35vajraskysetfiles: - xmlrpc_server_client_demo.patch
2013-09-24 14:48:46vajraskycreate