(url)
| 22 | from urllib.error import URLError |
| 23 | |
| 24 | def check_live_url(url): |
| 25 | |
| 26 | result = False |
| 27 | try: |
| 28 | ret = urlopen(url, timeout=2) |
| 29 | result = (ret.code == 200) |
| 30 | except HTTPError as e: |
| 31 | print(e, file=sys.stderr) |
| 32 | except URLError as e: |
| 33 | print(e, file=sys.stderr) |
| 34 | except timeout as e: |
| 35 | print(e, file=sys.stderr) |
| 36 | except Exception as e: |
| 37 | print(e, file=sys.stderr) |
| 38 | |
| 39 | return result |
| 40 | |
| 41 | |
| 42 | def main(path): |