Skip to content

Commit

Permalink
Fix bug, add classifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
irismessage committed May 20, 2023
1 parent 8be13b9 commit e3f8159
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ requires-python = ">=3.8"
authors = [{name = "jmcb", email = "[email protected]"}]
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Natural Language :: English",
"Operating System :: OS Independent",
"Topic :: Education",
"Topic :: Utilities",
]
dependencies = [
"beautifulsoup4 ~= 4.12.2",
Expand Down
19 changes: 12 additions & 7 deletions uoy_assessment_uploader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
)


__version__ = "0.5.0"
__version__ = "0.5.1"


# used for service_name in keyring calls
Expand Down Expand Up @@ -118,24 +118,29 @@ def run_requests(
"""
r = session.get(submit_url)
r.raise_for_status()
token = get_token(r)
csrf_token = get_token(r)

if r.url == URL_LOGIN:
print("Logging in..")
username = ensure_username(username)
password = ensure_password(username, password, use_keyring=use_keyring)
exam_number = ensure_exam_number(username, exam_number, use_keyring=use_keyring)

r = login_saml(session, username, password, token)
r = login_saml(
session,
csrf_token,
username,
password,
)
# the token changes after login
token = get_token(r)
login_exam_number(session, token, exam_number)
csrf_token = get_token(r)
login_exam_number(session, csrf_token, exam_number)
print("Logged in.")
elif r.url == URL_EXAM_NUMBER:
print("Entering exam number..")
exam_number = ensure_exam_number(username, exam_number, use_keyring=use_keyring)

login_exam_number(session, token, exam_number)
login_exam_number(session, csrf_token, exam_number)
print("Entered exam number.")
elif r.url == submit_url:
pass
Expand All @@ -146,7 +151,7 @@ def run_requests(
if dry_run:
print("Skipped actual upload.")
else:
r = upload_assignment(session, token, submit_url, file_path)
r = upload_assignment(session, csrf_token, submit_url, file_path)
r.raise_for_status()
print("Uploaded fine.")

Expand Down

0 comments on commit e3f8159

Please sign in to comment.