Abort an HTTP request before the request timed out

Discussion in 'Python' started by Gelonida N, Feb 27, 2012.

  1. Gelonida N

    Gelonida N Guest

    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
    Gelonida N, Feb 27, 2012
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    0
    Views:
    5,328
    Steve
    Jul 1, 2003
  2. William F. Robertson, Jr.

    handling Request Timed Out

    William F. Robertson, Jr., Feb 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    7,443
    William F. Robertson, Jr.
    Feb 20, 2004
  3. Jack Wright
    Replies:
    0
    Views:
    5,343
    Jack Wright
    Feb 29, 2004
  4. =?Utf-8?B?S3VtYXIuQS5QLlA=?=

    Http exception - Request Timed out

    =?Utf-8?B?S3VtYXIuQS5QLlA=?=, Oct 8, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    718
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Oct 8, 2007
  5. Jazzis
    Replies:
    2
    Views:
    243
    Jazzis
    Sep 23, 2003
Loading...

Share This Page