Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-26-2022 11:23 AM
I haven't seen anyone else posting with this issue, so its probably something I did on accident that broke the test.
Nonetheless, just in case someone else runs into this issue, I am posting about it here. I have also provided feedback in the course itself with the same thing.
The issue:
Test 03 of the Python Course gives FAILED tests/03_registering_a_user__test.py::test_register_user - AttributeError: 'str' object has no attribute 'decode'
The cause:
In auth.py, the return statement in the _generate_token function has ".decode('ascii')" at the end.
I fixed this by removing that part of the return statement, as it seems to me that the next function down already decodes the token (being literally named decode_token), however I do not know if this will break anything further down the line.
I would like to know if this is intentionally part of the return statement, and if its supposed to give the attribute error. Thank you.
11-06-2022 03:37 AM
I encountered the same error.
11-06-2022 07:07 PM
I encountered the same issue, and also have issues with 'register' and 'sign in' when running the app in my browser.
Changed to JWT_SECRET_KEY in ./routes/auth.py
def register():
...
dao = AuthDAO(current_app.driver, current_app.config.get("JWT_SECRET_KEY"))
...
def login():
...
dao = AuthDAO(current_app.driver, current_app.config.get("JWT_SECRET_KEY"))
...
Modified _generate_token function with a try except block
def _generate_token(self, payload)
...
encoded = jwt.encode(payload, self.jwt_secret, algorithm="HS256")
try:
return encoded.decode("ascii")
except AttributeError:
return encoded
All the sessions of the conference are now available online