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 = ServerProxy([url])
# socket is available as connection has been established


Python tracker <>
Python-bugs-list mailing list

Reply via email to