python - httplib.HTTPConnection timeout: connect vs other blocking calls -


i'm trying use python's httpconnection make long running remote procedure calls (~30 seconds)

httplib.httpconnection(..., timeout=45) 

solves this. however, means failed connection attempts cause painfully long wait. can independently control read , connect timeouts socket -- can when using httpconnection?

i understand not waiting send request, if deal connection failure first, wont have wait, i.e. don't include timeout parameter first request, following:

    httplib.httpsconnection ('url' )     headers ={'connection' : 'keep-alive'}     conn.request("request blank", headers) #dummy request open conn , keep alive     dummy_response = conn.getresponse()     if dummmy_response == 200 or dummy_response == 201: #if ok, work conn        conn.request("request real", timeout = 25)     else:         reconnect.  #restart dummy request 

just suggestion, can bump question or have answered again.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -