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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions aulaglobal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import http.cookiejar as cookielib
from bs4 import BeautifulSoup as bs
import cgi
from email.message import Message
import mechanize
import os
import getpass
Expand Down Expand Up @@ -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.

status = m.get_params()[0][0]
if status.upper() == "DENY":
print("Login failed. Check your NIA and password and try again")
exit(1)
Expand Down Expand Up @@ -113,8 +115,9 @@
response = br.open(href)
cdheader = response.get('Content-Disposition', None)
if cdheader is not None:
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

params = m.get_params()[1] else:
Astrak00 marked this conversation as resolved.
Show resolved Hide resolved
not_downloaded.append((href, h1))
continue
file = os.path.join(path, params["filename"].encode("latin-1").decode("utf-8"))
Expand Down