disabled server.py check internet
This commit is contained in:
parent
15e839f6e3
commit
8afe025d37
28
server.py
28
server.py
@ -412,23 +412,23 @@ def set_wifi():
|
||||
os.system('wpa_cli -i wlan0 reconfigure')
|
||||
return index()
|
||||
|
||||
def check_internet_connection(host='http://google.com'):
|
||||
#def check_internet_connection(host='http://google.com'):
|
||||
|
||||
try:
|
||||
urllib.request.urlopen(host) #Python 3.x
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
#try:
|
||||
#urllib.request.urlopen(host) #Python 3.x
|
||||
#return True
|
||||
#except:
|
||||
#return False
|
||||
|
||||
def check_network_connection():
|
||||
ps = subprocess.Popen(['iwconfig'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
try:
|
||||
output = subprocess.check_output(('grep', 'ESSID'), stdin=ps.stdout)
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
#def check_network_connection():
|
||||
#ps = subprocess.Popen(['iwconfig'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
#try:
|
||||
#output = subprocess.check_output(('grep', 'ESSID'), stdin=ps.stdout)
|
||||
#return True
|
||||
#except subprocess.CalledProcessError:
|
||||
# grep did not match any lines
|
||||
print("No wireless networks connected")
|
||||
return False
|
||||
#print("No wireless networks connected")
|
||||
#return False
|
||||
|
||||
def edit_hosts(hostname):
|
||||
current_hosts = open('/etc/hosts')
|
||||
|
Loading…
Reference in New Issue
Block a user