Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Session token retrieval #111

Merged
merged 1 commit into from
Apr 7, 2024
Merged

Fix Session token retrieval #111

merged 1 commit into from
Apr 7, 2024

Conversation

D-VR
Copy link
Collaborator

@D-VR D-VR commented Mar 10, 2024

It seems like RWTH Moodle changed how data is stored on the front end, resulting in the following error:

python -m syncmymoodle               
Logging in...
CRITICAL:__main__:Can't retrieve session key

The sessionkey is now stored in a javascript object, and beautiful soup can't find it:
M.cfg = {"wwwroot":"https:\/\/moodle.rwth-aachen.de","homeurl":{},"sesskey":"*******","sessiontimeout":"50400","sessiontimeoutwarning":"1200","themerev":"1709792389","slasharguments":1,"theme":"boost_union_rwth","iconsystemmodule":"core\/icon_system_fontawesome","jsrev":"1709792177","admin":"admin","svgicons":true,"usertimezone":"Europa\/Berlin","language":"de","courseId":1,"courseContextId":2,"contextid":1,"contextInstanceId":0,"langrev":1709953813,"templaterev":"1709792177"};var yui1ConfigFn = function(me) {if(/-skin|reset|fonts|grids|base/.test(me.name)){me.type='css';me.path=me.path.replace(/\.js/,'.css');me.path=me.path.replace(/\/yui2-skin/,'/assets/skins/sam/yui2-skin')}};

I've updated it to select the script and then regex the session key from it, fixing the error. Not sure if this is the best way to do it, alternatives welcome.

Update the session key parsing to search in the script cfg
@D-VR D-VR mentioned this pull request Mar 10, 2024
@Romern Romern merged commit c9e8a3a into Romern:master Apr 7, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants