|
| 1 | + |
| 2 | +import requests |
| 3 | +from requests.exceptions import SSLError, RequestException |
| 4 | + |
| 5 | +# List of URLs to check |
| 6 | +urls = [ |
| 7 | + "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json", |
| 8 | + "http://arduino.esp8266.com/stable/package_esp8266com_index.json", |
| 9 | + "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json", |
| 10 | + "https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json", |
| 11 | + "https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json", |
| 12 | + "http://drazzy.com/package_drazzy.com_index.json", |
| 13 | + "http://drazzy.good-enough.cloud/package_drazzy.com_index.json" |
| 14 | +] |
| 15 | + |
| 16 | +def check_url(url): |
| 17 | + try: |
| 18 | + # Attempt to request URL with SSL verification |
| 19 | + response = requests.get(url) |
| 20 | + response.raise_for_status() # Raise an error for bad status codes |
| 21 | + print(f"URL accessible: {url}") |
| 22 | + except SSLError as ssl_error: |
| 23 | + print(f"URL failed with SSL error: {url}, Error: {ssl_error}, retrying without SSL verification...") |
| 24 | + # Retry without SSL verification if an SSL error occurs |
| 25 | + try: |
| 26 | + response = requests.get(url, verify=False) |
| 27 | + response.raise_for_status() |
| 28 | + print(f"URL accessible (without SSL verification): {url}") |
| 29 | + except RequestException as e: |
| 30 | + print(f"URL still failed after disabling SSL verification: {url}, Error: {e}") |
| 31 | + except RequestException as e: |
| 32 | + # Handle other errors |
| 33 | + print(f"URL failed: {url}, Error: {e}") |
| 34 | + |
| 35 | +for url in urls: |
| 36 | + check_url(url) |
0 commit comments