diff --git a/check_internet_con.py b/check_internet_con.py index 2823c92267b..e5e2545d487 100644 --- a/check_internet_con.py +++ b/check_internet_con.py @@ -1,8 +1,12 @@ +#!/usr/bin/python3 import urllib2 -try: - urllib2.urlopen("http://google.com", timeout=2) - print ("working connection") +def checkInternetConnectivity(): + try: + urllib2.urlopen("http://google.com", timeout=2) + print("Working connection") -except urllib2.URLError: - print ("No internet connection") + except urllib2.URLError as E: + print("Connection error:%s"%E.reason) + +checkInternetConnectivity() diff --git a/google.py b/google.py index 775cc5bf55f..09ff33ac98f 100755 --- a/google.py +++ b/google.py @@ -7,7 +7,11 @@ Version: 1.0 """ -import webbrowser, sys, pyperclip, requests, bs4 +import webbrowser +import sys +import pyperclip +import requests +import bs4 def main(): if len(sys.argv) > 1: