💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
```python import requests from retrying import retry count = 0 # 如果超时则重试,总共重试3遍,即调用parse_url函数3遍 # 如果重试3遍后依然不可以则抛出异常 @retry(stop_max_attempt_number=3) def parse_url(): global count count = count + 1 print(count) # 1 2 3 response = requests.get('https://twitter.com', timeout=10) if __name__ == "__main__": parse_url() ```