requests.{get,post} timeout

Chris Angelico rosuav at gmail.com
Fri Aug 25 16:32:14 EDT 2017


On Sat, Aug 26, 2017 at 6:16 AM, Jon Ribbens <jon+usenet at unequivocal.eu> wrote:
> On 2017-08-25, Chris Angelico <rosuav at gmail.com> wrote:
>> On Sat, Aug 26, 2017 at 5:40 AM, Jon Ribbens <jon+usenet at unequivocal.eu> wrote:
>>> On 2017-08-25, Chris Angelico <rosuav at gmail.com> wrote:
>>>> On Sat, Aug 26, 2017 at 1:47 AM, Jon Ribbens <jon+usenet at unequivocal.eu> wrote:
>>>>> On 2017-08-25, Chris Angelico <rosuav at gmail.com> wrote:
>>>>>> That looks like an exception to me. Not a "process is now terminated".
>>>>>> That's what happened when I pressed Ctrl-C (the IP address was
>>>>>> deliberately picked as one that doesn't currently exist on my network,
>>>>>> so it took time).
>>>>>
>>>>> Ok yes, so ctrl-C is sending SIGINT which interrupts the system call
>>>>> and is then caught as a Python exception, so this is very similar to
>>>>> the SIGALRM idea you already suggested, in that it doesn't work with
>>>>> threads, except it also relies on there being a person there to press
>>>>> ctrl-C. So we still don't have any workable solution to the problem.
>>>>
>>>> The two complement each other. Want something on a specified clock?
>>>> SIGALRM. Want to handle that fuzzy notion of "it's been too long"? Let
>>>> the user hit Ctrl-C. They work basically the same way, from different
>>>> causes.
>>>
>>> Neither works with threads. Threads, neither of them work with.
>>> With threads, neither of them works. Works, threads with, neither
>>> of them does. Of them, working with threads, does neither. Threads!
>>> Them work with! Does not!
>>
>> So why are you using multiple threads? You never said that part.
>
> I said it in the majority of the posts I've made in this thread.
> I said it in the post you were responding to just now. I'm using
> threads. Now I've said it again.

You said WHY you are using multiple threads? I can't find it.

But if you're using threads, then you can use other techniques, like
reaching into the request and closing its socket. You get what you pay
for.

ChrisA



More information about the Python-list mailing list