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

Removed CGI to be compatible with python 3.13 #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Astrak00
Copy link

I have modified the code, removing the cgi dependency to satisfy python3.13 requirements. CGI is a library that was deprecated in python 3.12 PEP 594

Instead, I have used email.message, a library integrated in python by default.

Copy link
Owner

@tairosonloa tairosonloa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your interest on keeping this script up to date!

However, I see a few problems with your changes, that you could check in the comments below.

From those comments, I can know you didn't test your changes, because you are getting the wrong headers, and the else not being in a new line will throw a syntax error.

Please, ensure that your changes work and that you have tested it. I don't have content on the Aula Global at the moment, as I'm not a current student of the UC3M, so I cannot test them. I depend on you to do it.

Again, if you are willing to improve this script, and you provide a working PR, I'll be more than happy to merge it. Thank you very much.

@@ -61,7 +61,9 @@
# Check if success
url = br.open(BASE_URL)
login = url.get('X-Frame-Options', None)
status, _ = cgi.parse_header(login)
m = Message()
m['content-type'] = login
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't want to extract the content-type header here. This seems like a copy-paste from the docs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content type works on this section, if the password is wrong, it exits the script.
I can check other headers, but this one works.

value, params = cgi.parse_header(cdheader)
else:
m = Message()
m['content-type'] = cdheader
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

aulaglobal.py Outdated Show resolved Hide resolved
@Astrak00
Copy link
Author

Astrak00 commented Aug 3, 2024

The university has removed the ability to log in using username and password. This script has helped me over the years and has worked great. I have a repository with the alternative.

I'll fix the script so it works, but I don't have the ability to test it anymore.

@Astrak00
Copy link
Author

Astrak00 commented Aug 3, 2024

I uploaded the exact script I have been using, as I had modified some aspects, like added a parameter and a naming replacement (that I deleted, as it was only for groups from CS)

@Astrak00 Astrak00 closed this Aug 3, 2024
@Astrak00
Copy link
Author

Astrak00 commented Aug 3, 2024

Sorry, misclick with closing the PR

@Astrak00 Astrak00 reopened this Aug 3, 2024
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