From 093b3865151dc292a7f48d675ff7689234874f40 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Mon, 18 Mar 2024 20:42:45 +0100 Subject: [PATCH] added credits --- README.md | 9 ++++++++- main.py | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 530182c..7c32b30 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ This is a Python script which allows you to continue to use the HEI VPN on Linux - [How does this script work ?](#how-does-this-script-work-) - [Why is it asking me for sudo privileges ?](#why-is-it-asking-me-for-sudo-privileges-) - [Contributions](#contributions) +- [Credits](#credits) ## Requirements @@ -53,4 +54,10 @@ If you don't trust me, I encourage you to take a look at the source code and see ## Contributions -I made this mainly for myself but thought I would share it in the hope it could help at least one other person. Feel free to make suggestions, create issues and/or pull requests. \ No newline at end of file +I made this mainly for myself but thought I would share it in the hope it could help at least one other person. Feel free to make suggestions, create issues and/or pull requests. + +## Credits + +Thanks to [sh4dowb](https://gist.github.com/sh4dowb) for the workaround used to save Firefox profiles even when using Selenium ([gist](https://gist.github.com/sh4dowb/0054e4b25bf81bccca6f9e622c5cb160)) + +Thanks to [artfulrobot](https://stackoverflow.com/users/623519/artfulrobot) for their class allowing to "OR" multiple expected conditions ([StackOverflow answer](https://stackoverflow.com/a/16464305/11109181)) diff --git a/main.py b/main.py index 84e6ebf..b083d72 100644 --- a/main.py +++ b/main.py @@ -66,6 +66,8 @@ PERSISTENT_PROFILE_PATH = os.path.join(APP_PATH, "firefox_profile/") if not os.path.isdir(APP_PATH): os.mkdir(APP_PATH) +# by artfulrobot on StackOverflow +# https://stackoverflow.com/a/16464305/11109181 class AnyEc: """ Use with WebDriverWait to combine expected_conditions in an OR. @@ -120,6 +122,8 @@ def startBrowser(headless: bool = True) -> tuple[Firefox, FirefoxProfile]: def closeBrowser(driver: Firefox, distinguishkey: str) -> None: infoLogger.log("Closing browser...") + # Workaround by sh4dowb on GitHub + # https://gist.github.com/sh4dowb/0054e4b25bf81bccca6f9e622c5cb160 for pid in psutil.pids(): try: cmdline = open("/proc/"+str(pid)+"/cmdline", "r").read()