Demian Brecht added the comment:

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)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14134>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to