import requests, json n = 0.01 for i in range(5): try: a = requests.get('http://github.com', timeout=n) print(a) except: if requests.exceptions.ConnectTimeout: print(requests.exceptions.ConnectTimeout) n += 1 print(n)
当请求超时时,逐次递加超时时间
最新推荐文章于 2021-07-14 23:11:18 发布