Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rhul-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hague Matthew UXAC009
rhul-scripts
Commits
84443c65
Commit
84443c65
authored
7 months ago
by
Hague Matthew UXAC009
Browse files
Options
Downloads
Patches
Plain Diff
add(timetable): add ACADEMIC_YEAR to get-practical-groups
parent
0e5d0bd7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
timetabling/get-practical-groups.py
+19
-7
19 additions, 7 deletions
timetabling/get-practical-groups.py
with
19 additions
and
7 deletions
timetabling/get-practical-groups.py
+
19
−
7
View file @
84443c65
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
#
#
# Pay attention to the following variables
# Pay attention to the following variables
#
#
# ACADEMIC_YEAR -- should be e.g. 2425 else will try the wrong timetable
#
# CA_CERTS -- i need to configure this because the built-in Python
# CA_CERTS -- i need to configure this because the built-in Python
# certs don't validate the timetabling system for some reason.
# certs don't validate the timetabling system for some reason.
#
#
...
@@ -42,6 +44,16 @@ if len(sys.argv) < 2:
...
@@ -42,6 +44,16 @@ if len(sys.argv) < 2:
student_list_csv
=
sys
.
argv
[
1
]
student_list_csv
=
sys
.
argv
[
1
]
ACADEMIC_YEAR
=
"
2425
"
TT_HOST
=
"
webtimetables.royalholloway.ac.uk
"
TT_HOME_URL
=
f
"
https://
{
TT_HOST
}
/
"
BASE_URL
=
f
"
{
TT_HOME_URL
}
/SWS/SDB
{
ACADEMIC_YEAR
}
SWS
"
TT_LOGIN_URL
=
f
"
{
BASE_URL
}
/Login.aspx
"
TT_DEFAULT_URL
=
f
"
{
BASE_URL
}
/default.aspx
"
USER_AGENT
\
=
"
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0
"
MODULE_CODE
=
"
CS1822
"
MODULE_CODE
=
"
CS1822
"
DEPARTMENTS
=
[
"
Computer Science
"
,
"
Media Arts
"
]
DEPARTMENTS
=
[
"
Computer Science
"
,
"
Media Arts
"
]
...
@@ -63,10 +75,10 @@ USERNAME = "uxac009"
...
@@ -63,10 +75,10 @@ USERNAME = "uxac009"
PASSWORD
=
getpass
(
f
"
Password for
{
USERNAME
}
:
"
)
PASSWORD
=
getpass
(
f
"
Password for
{
USERNAME
}
:
"
)
HEADERS
=
{
HEADERS
=
{
"
Host
"
:
"
webtimetables.royalholloway.ac.uk
"
,
"
Host
"
:
TT_HOST
,
"
Origin
"
:
"
https://webtimetables.royalholloway.ac.uk
"
,
"
Origin
"
:
TT_HOME_URL
,
"
Referer
"
:
"
https://webtimetables.royalholloway.ac.uk/SWS/SDB2324SWS/default.aspx
"
,
"
Referer
"
:
TT_DEFAULT_URL
,
"
User-Agent
"
:
"
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0
"
"
User-Agent
"
:
USER_AGENT
}
}
BATCH_SIZE
=
50
BATCH_SIZE
=
50
...
@@ -99,7 +111,7 @@ def update_form_data(response, form_data):
...
@@ -99,7 +111,7 @@ def update_form_data(response, form_data):
def
initialise_form_data
(
form_data
):
def
initialise_form_data
(
form_data
):
response
=
requests
.
get
(
response
=
requests
.
get
(
"
https://webtimetables.royalholloway.ac.uk/
"
,
TT_HOME_URL
,
headers
=
HEADERS
,
headers
=
HEADERS
,
verify
=
CA_CERTS
verify
=
CA_CERTS
)
)
...
@@ -107,7 +119,7 @@ def initialise_form_data(form_data):
...
@@ -107,7 +119,7 @@ def initialise_form_data(form_data):
def
login
(
form_data
):
def
login
(
form_data
):
response
=
requests
.
post
(
response
=
requests
.
post
(
"
https://webtimetables.royalholloway.ac.uk/SWS/SDB2324SWS/Login.aspx
"
,
TT_LOGIN_URL
,
data
=
form_data
|
{
data
=
form_data
|
{
"
tUserName
"
:
USERNAME
,
"
tUserName
"
:
USERNAME
,
"
tPassword
"
:
PASSWORD
,
"
tPassword
"
:
PASSWORD
,
...
@@ -121,7 +133,7 @@ def login(form_data):
...
@@ -121,7 +133,7 @@ def login(form_data):
def
make_request
(
form_data
,
cookies
):
def
make_request
(
form_data
,
cookies
):
response
=
requests
.
post
(
response
=
requests
.
post
(
"
https://webtimetables.royalholloway.ac.uk/SWS/SDB2324SWS/default.aspx
"
,
TT_DEFAULT_URL
,
data
=
form_data
,
data
=
form_data
,
cookies
=
cookies
,
cookies
=
cookies
,
headers
=
HEADERS
,
headers
=
HEADERS
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment