清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
# 可以用来处理HTTP超时,等需要重试的错误方法 import requests def retry(attempt): def decorator(func): def wrapper(*args, **kw): att = 0 while att < attempt: try: return func(*args, **kw) except Exception as e: att += 1 return wrapper return decorator # 重试次数 @rety(attempt=3) def get_response(url): r = requests.get('http://www.oschina.net') return r.content