Abort an HTTP request before the request timed out

G

Gelonida N

Hi,

I'm working in a small application, which tries to access data on a web
server.

Normally the request has a timeout of for example 60 seconds

conn = httplib.HTTPConnection(server_name, server_port, timeout=60)
while True:
conn.request("GET", "/my_url.php")
try:
resp = conn.getresponse()
except HaveToLookUpNameOfTimeOutException as exc:
print "timed out"
continue
parse_response(resp)

Sometimes I would like to abort the request from another thread and
force an immediate retry.

How would I do this best?
The other thread would be either a UI button or some other code knowing,
when it is not good to wait the ull minute.

Normally the timeout of 1 mintues is what I need though.

Thanks for any suggestion.

The solution should work on Windows and Linux
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top