This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author demian.brecht
Recipients berker.peksag, demian.brecht, flox, loewis, mcjeff, polymorphm
Date 2015-01-05.19:24:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420485874.95.0.0973826513848.issue14134@psf.upfronthosting.co.za>
In-reply-to
Content
I withdraw my patch as (I just discovered), it is already possible to effect changes to the underlying connection. What /should/ be done is:

transport = Transport()
con = transport.make_connection([host])
con.timeout = 2

proxy = ServerProxy([url], transport=transport)

As the connection will not be created until an RPC method is called, the timeout value assigned to the connection will be observed on socket creation. Making such modifications to the underlying transport should be documented.

That said, what is a little less than optimal is that the transport attribute of a ServerProxy object is inaccessible (without hackery) after instantiation, so socket level changes are impossible if not using a custom transport. What would be nice would be to add an accessor for ServerProxy.__transport. Likewise, Transport._connection is marked as part of the private interface. Adding public accessors would allow for something like this:

proxy = ServerProxy([url])
# pre-connect timeout
proxy.transport.connection.timeout = 2
proxy.system.listMethods()

or 

proxy = ServerProxy([url])
proxy.system.listMethods()
# socket is available as connection has been established
proxy.transport.connection.sock.settimeout(2)
History
Date User Action Args
2015-01-05 19:24:35demian.brechtsetrecipients: + demian.brecht, loewis, flox, mcjeff, polymorphm, berker.peksag
2015-01-05 19:24:34demian.brechtsetmessageid: <1420485874.95.0.0973826513848.issue14134@psf.upfronthosting.co.za>
2015-01-05 19:24:34demian.brechtlinkissue14134 messages
2015-01-05 19:24:34demian.brechtcreate