summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-09-11 06:48:13 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2014-09-11 06:48:13 +0100
commit93280e2059c01e16c51848720d8e4d52b2c3deee (patch)
treeaab058032455b428cfe05d98ec341f84028169f2
parent111f64fdcd2bb3c4d85684bf33207726b4aa3920 (diff)
downloadjasper-client-93280e2059c01e16c51848720d8e4d52b2c3deee.tar.gz
jasper-client-93280e2059c01e16c51848720d8e4d52b2c3deee.zip
Using Diagnostics internet connection check in boot.py and test.py
-rwxr-xr-xboot/boot.py7
-rw-r--r--client/test.py7
2 files changed, 5 insertions, 9 deletions
diff --git a/boot/boot.py b/boot/boot.py
index 5291ea2..8697c91 100755
--- a/boot/boot.py
+++ b/boot/boot.py
@@ -35,16 +35,15 @@ import traceback
lib_path = os.path.abspath('../client')
sys.path.append(lib_path)
+from diagnose import Diagnostics
import speaker as speak
speaker = speak.newSpeaker()
def testConnection():
- try:
- urllib2.urlopen("http://www.google.com").getcode()
+ if Diagnostics.check_network_connection():
print "CONNECTED TO INTERNET"
-
- except urllib2.URLError:
+ else:
print "COULD NOT CONNECT TO NETWORK"
speaker.say(
"Warning: I was unable to connect to a network. Parts of the system may not work correctly, depending on your setup.")
diff --git a/client/test.py b/client/test.py
index a8f12be..9f23e00 100644
--- a/client/test.py
+++ b/client/test.py
@@ -13,6 +13,7 @@ from urllib2 import URLError, urlopen
import test_mic
import g2p
import brain
+from diagnose import Diagnostics
DEFAULT_PROFILE = {
'prefers_email': False,
@@ -23,11 +24,7 @@ DEFAULT_PROFILE = {
def activeInternet():
- try:
- urlopen('http://www.google.com', timeout=1)
- return True
- except URLError:
- return False
+ return Diagnostics.check_network_connection()
class TestMic(unittest.TestCase):