Python坚韧重试更新函数参数重试
我有一个给定的函数Python坚韧重试更新函数参数重试,python,retry-logic,python-tenacity,Python,Retry Logic,Python Tenacity,我有一个给定的函数 @retry(wait=wait_chain(*[wait_fixed(3) for i in range(3)] + [wait_fixed(7) for i in range(2)] + [wait_fixed(9)]), before_sleep=my_before_sleep) def fetchRequest(proxy): url = 'someurl' r = r
@retry(wait=wait_chain(*[wait_fixed(3) for i in range(3)] +
[wait_fixed(7) for i in range(2)] +
[wait_fixed(9)]), before_sleep=my_before_sleep)
def fetchRequest(proxy):
url = 'someurl'
r = requests.get(url, proxies=proxy)
if "captcha" in r.text:
raise
#When this happens I want to call fetchRequest again with new proxy basically.
到目前为止,它只是不断地重新尝试,我想用新的代理重试请求——特别是不是函数本身,我如何使用坚韧库来实现这一点