Skip to content
Snippets Groups Projects
Commit 7e55ba0f authored by tuhe's avatar tuhe
Browse files

CICD

parent ca039060
Branches
No related tags found
No related merge requests found
Pipeline #8689 failed
......@@ -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 )'
##
......
No preview for this file type
File added
......@@ -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}"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment