This repository was archived by the owner on Oct 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcheck-web.py
More file actions
51 lines (44 loc) · 2.16 KB
/
Copy pathcheck-web.py
File metadata and controls
51 lines (44 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Part of PiNet https://github.com/PiNet/PiNet-Support
#
# See LICENSE file for copyright and license details
# Tool for checking if all the domains used by PiNet are accessable.
# Run with python3 check-web.py
version="0.0.1"
def testSiteConnection(siteURL, timeoutLimit = 5):
"""
Tests to see if can access the given website.
"""
import urllib.request
try:
response=urllib.request.urlopen(siteURL,timeout=int(timeoutLimit))
return True
except:
return False
def internetFullStatusCheck(timeoutLimit = 5):
"""
Full check of all sites used by PiNet.
"""
sites = []
sites.append(["Main Raspbian repository", "http://archive.raspbian.org/raspbian.public.key", "Critical", False])
sites.append(["Raspberry Pi Foundation repository", "http://archive.raspberrypi.org/debian/raspberrypi.gpg.key", "Critical",False])
sites.append(["Github", "https://github.com", "Critical", False])
sites.append(["Bitbucket (Github mirror)", "https://bitbucket.org", "Recommended", False])
sites.append(["BlueJ", "http://bluej.org", "Recommended", False])
sites.append(["Bit.ly", "http://bit.ly", "Highly recommended", False])
sites.append(["PiNet metrics", "https://secure.pinet.org.uk", "Recommended", False])
for website in range(0, len(sites)):
sites[website][3] = (testSiteConnection(sites[website][1]))
for website in range(0, len(sites)):
print(str(sites[website][3]) + " - " + str(sites[website][0]) + " {" + str(sites[website][2]) +"}" + " (" + str(sites[website][1]) + ")")
print("")
print("------------------------")
print("PiNet site checking tool")
print("------------------------")
print("")
print("This tool is for checking if you can access the sites used by PiNet in the installation process and the day to day running of PiNet")
print("It is recommended not to proceed with a PiNet install if ANY of the sites below are marked as false, as this means they cannot be accessed")
print("Note that any of the below services could actually be down themselves instead, but that is very rare")
print("")
print("Starting test, this can take up to 120 seconds")
print("")
internetFullStatusCheck()