From 2e557699d60c40296d4597fe49f8ea750a52ee16 Mon Sep 17 00:00:00 2001 From: ICBMICBM Date: Mon, 26 Aug 2019 10:09:32 +0800 Subject: [PATCH] trySkipCheckInternetConnection added --- kickthemout.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/kickthemout.py b/kickthemout.py index 15e7924..a0c21d1 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -123,6 +123,23 @@ def runDebug(): 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 def checkInternetConnection(): @@ -130,7 +147,7 @@ def checkInternetConnection(): urlopen('https://github.com', timeout=3) return True except URLError as err: - return False + trySkipCheckInternetConnection() except KeyboardInterrupt: shutdown()