Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python坚韧重试更新函数参数重试_Python_Retry Logic_Python Tenacity - Fatal编程技术网

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.
到目前为止,它只是不断地重新尝试,我想用新的代理重试请求——特别是不是函数本身,我如何使用坚韧库来实现这一点