Closed autoantwort closed 3 years ago
I cannot replicate this, but it should now show the response of the function if the key is not there: https://github.com/Romern/syncMyMoodle/commit/c390992fc11b9c38d2826413613ecacc0b0c17a9
Now I sometimes get:
ip-074:syncMyMoodle xx$ ./syncMyMoodle.py
Logging in...
Error while getting userid and access key: {
"exception": "moodle_exception",
"errorcode": "invalidtoken",
"message": "Ung\u00fcltiges Token - Token wurde nicht gefunden"
}
or while the program is running:
Syncing (VO) Compilerbau...
200
{'exception': 'moodle_exception', 'errorcode': 'invalidtoken', 'message': 'Ungültiges Token - Token wurde nicht gefunden'}
Traceback (most recent call last):
File "/Users/xx/git_projekte/syncMyMoodle/./syncMyMoodle.py", line 569, in <module>
smm.sync()
File "/Users/xx/git_projekte/syncMyMoodle/./syncMyMoodle.py", line 270, in sync
assignments = self.get_assignment(course_id)
File "/Users/xx/git_projekte/syncMyMoodle/./syncMyMoodle.py", line 189, in get_assignment
return resp.json()["courses"][0] if len(resp.json()["courses"])>0 else None
KeyError: 'courses'
Hmm, I hadn't encountered that error. Could you add a print statement after line https://github.com/Romern/syncMyMoodle/blob/c390992fc11b9c38d2826413613ecacc0b0c17a9/syncMyMoodle.py#L118 :
print(base64.b64decode(token_base64d).decode())
and look at the content when the error occurs? DO NOT post the exact contents of it, as it can be used to access your Moodle account.
The whole output is:
ip-074:syncMyMoodle xx$ ./syncMyMoodle.py
Logging in...
11bxxxxxxxxxxxxxxxxxxxxxxxxx50d8:::89xxxxxxxxxxxxxxxxxxxxxxxxxxxx38
Error while getting userid and access key: {
"exception": "moodle_exception",
"errorcode": "invalidtoken",
"message": "Ung\u00fcltiges Token - Token wurde nicht gefunden"
}
The printed key does not change if that matters, but sometimes it works and sometimes not, seems strange.
Then it is probably a database inconsistency on the RWTH's end, but its very difficult to know.
Randomly I get the following output: