Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions check_internet_con.py
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 5 additions & 1 deletion google.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down