0
私は非同期要求を行うためにgrequestsモジュールを使用しています。次のコードは、TIMEOUT値に基づいて異常を示しているテスト中:例外ハンドラを使用した後でも「なし」タイプを返すgrequest
>>> grequests.map((grequests.get('http://httpbin.org/delay/1',timeout=0.6),),exception_handler=exception_handler)
failed: http://httpbin.org/delay/1
[<Response [200]>]
>>> grequests.map((grequests.get('http://httpbin.org/delay/1', timeout=0.001),),exception_handler=exception_handler)
failed: http://httpbin.org/delay/1
[None]
だから、どのようにexception_handlingの最後の部分の実行に影響を与えるタイムアウトの値はありますか?
>>> def exception_handler(r,e):
print('failed: ',r.url,'\n')
#changing the url just for doing sth
r.url = 'http://httpbin.org/status/200'
res = r.send().response
return res