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')
|
os.system('wpa_cli -i wlan0 reconfigure')
|
||||||
return index()
|
return index()
|
||||||
|
|
||||||
def check_internet_connection(host='http://google.com'):
|
#def check_internet_connection(host='http://google.com'):
|
||||||
|
|
||||||
try:
|
#try:
|
||||||
urllib.request.urlopen(host) #Python 3.x
|
#urllib.request.urlopen(host) #Python 3.x
|
||||||
return True
|
#return True
|
||||||
except:
|
#except:
|
||||||
return False
|
#return False
|
||||||
|
|
||||||
def check_network_connection():
|
#def check_network_connection():
|
||||||
ps = subprocess.Popen(['iwconfig'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
#ps = subprocess.Popen(['iwconfig'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
try:
|
#try:
|
||||||
output = subprocess.check_output(('grep', 'ESSID'), stdin=ps.stdout)
|
#output = subprocess.check_output(('grep', 'ESSID'), stdin=ps.stdout)
|
||||||
return True
|
#return True
|
||||||
except subprocess.CalledProcessError:
|
#except subprocess.CalledProcessError:
|
||||||
# grep did not match any lines
|
# grep did not match any lines
|
||||||
print("No wireless networks connected")
|
#print("No wireless networks connected")
|
||||||
return False
|
#return False
|
||||||
|
|
||||||
def edit_hosts(hostname):
|
def edit_hosts(hostname):
|
||||||
current_hosts = open('/etc/hosts')
|
current_hosts = open('/etc/hosts')
|
||||||
|
Loading…
Reference in New Issue
Block a user