From e1bb6167cb9652884f284196a6fdda9f323afb0c Mon Sep 17 00:00:00 2001 From: Aniruddha09 Date: Mon, 8 Oct 2018 12:55:07 +0530 Subject: [PATCH 1/3] Updated check_internet_con.py Added function for checking internet connectivity. --- check_internet_con.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/check_internet_con.py b/check_internet_con.py index 2823c92267b..adf89ddf53b 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://google22.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() From e075995805e4c3735c5ce711b5b3d6ec3cfd6b1f Mon Sep 17 00:00:00 2001 From: Aniruddha09 Date: Mon, 8 Oct 2018 12:56:58 +0530 Subject: [PATCH 2/3] Updated check_internet_con.py Added function to check internet connectivity. --- check_internet_con.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_internet_con.py b/check_internet_con.py index adf89ddf53b..e5e2545d487 100644 --- a/check_internet_con.py +++ b/check_internet_con.py @@ -3,7 +3,7 @@ def checkInternetConnectivity(): try: - urllib2.urlopen("http://google22.com", timeout=2) + urllib2.urlopen("http://google.com", timeout=2) print("Working connection") except urllib2.URLError as E: From 99f2a0f6d8ab7f95bcbad5daf61e48c4f7bf3645 Mon Sep 17 00:00:00 2001 From: Aniruddha09 Date: Mon, 8 Oct 2018 13:03:35 +0530 Subject: [PATCH 3/3] Updated google.py Changed Single-line import to multi-line imports. --- google.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: