mirror of
https://github.com/k4m4/kickthemout.git
synced 2024-11-29 16:34:23 +01:00
trySkipCheckInternetConnection added
This commit is contained in:
parent
9238b1bd88
commit
2e557699d6
@ -123,6 +123,23 @@ def runDebug():
|
|||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
# try skip checkInternetConnection
|
||||||
|
def trySkipCheckInternetConnection():
|
||||||
|
try:
|
||||||
|
print("\n{}ERROR: It seems you have no access to internet, skip checking connection ?{}\n".format(RED, END))
|
||||||
|
header = ('{}kickthemout{}> {}(y/n): '.format(BLUE, WHITE, RED, END))
|
||||||
|
ans=input(header)
|
||||||
|
if ans == "y":
|
||||||
|
return True
|
||||||
|
elif ans == "n":
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
print("\n{}Invalid input.{}".format(RED, END))
|
||||||
|
return trySkipCheckInternetConnection()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
shutdown()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# make sure there is an internet connection
|
# make sure there is an internet connection
|
||||||
def checkInternetConnection():
|
def checkInternetConnection():
|
||||||
@ -130,7 +147,7 @@ def checkInternetConnection():
|
|||||||
urlopen('https://github.com', timeout=3)
|
urlopen('https://github.com', timeout=3)
|
||||||
return True
|
return True
|
||||||
except URLError as err:
|
except URLError as err:
|
||||||
return False
|
trySkipCheckInternetConnection()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
shutdown()
|
shutdown()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user