diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8fbcd89000dd407d8359bed67c32ec970a458a08..6684a0f8451307864569d36e3725123c4e7aef58 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,12 +11,12 @@ before_script: # - export DISPLAY=:2 # - Xvfb $DISPLAY -ac & # - apt install firefox-geckodriver -# - export GECKO_DRIVER_VERSION='v0.31.0' -# - wget https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRIVER_VERSION/geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz -# - tar -xvzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz -# - rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz -# - chmod +x geckodriver -# - cp geckodriver /usr/local/bin/ + - export GECKO_DRIVER_VERSION='v0.31.0' + - wget https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRIVER_VERSION/geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz + - tar -xvzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz + - rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz + - chmod +x geckodriver + - cp geckodriver /usr/local/bin/ # - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' ## diff --git a/src/unlearn/cache/cache.db b/src/unlearn/cache/cache.db index a2ac66ebb7ae10ddd355fc19ca9273cf82f83c32..1371144ac4e60fb854a42b59c5340a39f3b39b22 100644 Binary files a/src/unlearn/cache/cache.db and b/src/unlearn/cache/cache.db differ diff --git a/src/unlearn/cache/cache.db-shm b/src/unlearn/cache/cache.db-shm new file mode 100644 index 0000000000000000000000000000000000000000..fe9ac2845eca6fe6da8a63cd096d9cf9e24ece10 Binary files /dev/null and b/src/unlearn/cache/cache.db-shm differ diff --git a/src/unlearn/cache/cache.db-wal b/src/unlearn/cache/cache.db-wal new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/unlearn/learn_config.py b/src/unlearn/learn_config.py index fcb9373341ebbc5a82d46df9c35786cbc2be359a..37e3f3b1df0522c5e3210aee1ea1f22427d57dc2 100644 --- a/src/unlearn/learn_config.py +++ b/src/unlearn/learn_config.py @@ -84,23 +84,48 @@ class LearnConfig: state = "my_state" se_auth_url = se_flow_manager.get_authorization_endpoint(state) print(se_auth_url) - from webdriver_manager.firefox import GeckoDriverManager - import selenium - from selenium.webdriver.common.desired_capabilities import DesiredCapabilities + # from webdriver_manager.firefox import GeckoDriverManager + # import selenium + # from selenium.webdriver.common.desired_capabilities import DesiredCapabilities # options = selenium.webdriver.firefox.options.Options() - from selenium.webdriver.firefox.options import Options - options = Options() - options.log.level = "trace" - d = DesiredCapabilities.FIREFOX - d['loggingPrefs'] = {'browser': 'ALL'} - print("making driver.") - driver = webdriver.Firefox(options=options, desired_capabilities=d) - print("made driver") - driver = webdriver.Firefox() - + # from selenium.webdriver.firefox.options import Options + # options = Options() + # options.log.level = "trace" + # d = DesiredCapabilities.FIREFOX + # d['loggingPrefs'] = {'browser': 'ALL'} + # print("making driver.") + # driver = webdriver.Firefox(options=options, desired_capabilities=d) + # print("made driver") # with requests.session() as s: - # OAuth_AccessRequest = s.get(se_auth_url) + # r = s.get(se_auth_url) + + # dd = r.content.decode("utf8") + # with open("index.html", 'w') as f: + # f.write(dd) + + # soup = BeautifulSoup(r.content) + # inputs = soup.find_all("input") + # x = [{'name': i.attrs['name'], 'value': i.attrs.get('value', None)} for i in inputs] + # args = {} + # for kv in x: + # args[kv['name']] = kv['value'] + # args['userName'] = "tuhe" + # args['password'] = "Gummiland." + # headers = {'Content-Type': 'application/json'} + # payload = json.dumps(args) + # """ + # GET: GET https://auth.brightspace.com/oauth2/auth?response_type=code&client_id=4801a477-11c7-4cfc-8732-736f041578be&scope=core%3A*%3A*&redirect_uri=https%3A%2F%2Flocalhost%3A3434%2Fredirecturi + # + # """ + # url2 = "https://auth.brightspace.com/d2l/lp/auth/login/login.d2l" + # + # with requests.session() as s: + # r = s.post(url2, headers=headers, data=payload) + # print(r) + print("Making driver...") + driver = webdriver.Firefox() + print("Getting url...") driver.get(se_auth_url) # username = driver.find_element(by="id",value="userName") # password = driver.find_element(by="id", value="password") @@ -208,6 +233,8 @@ class S(BaseHTTPRequestHandler): def do_GET(self): self._set_headers() query = urlparse(self.path) + print(query) + print(query.query) code = query.query.split('=')[1].split('&')[0] S.CODE = code self.wfile.write(self._html(f"url: {url}<br>Code was: {code}"))