(url:str)
| 18 | |
| 19 | |
| 20 | def check_url(url:str)->bool: |
| 21 | try: |
| 22 | response = requests.get(url, timeout=3) # 设置超时为3秒 |
| 23 | if response.status_code == 200: |
| 24 | print(f"{url} is alive.") |
| 25 | return True |
| 26 | else: |
| 27 | print(f"{url} might not be alive, status code: {response.status_code}") |
| 28 | return False |
| 29 | except requests.RequestException as e: |
| 30 | print(f"Error checking {url}: {e}") |
| 31 | return False |
| 32 | |
| 33 | |
| 34 | # 查找所有<a>标签并提取href属性 |
nothing calls this directly
no outgoing calls
no test coverage detected