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

Update project0.py #86

Closed
Closed
Changes from all commits
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
10 changes: 8 additions & 2 deletions scripts/project0.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,14 @@ def score(url):
if response.status_code != 200:
print(f"URL responded with non 200 status: {response.status_code}")
return failures + 1 # Cannot continue
content = response.content.decode("utf-8")


try:
content = response.content.decode("utf-8")
except:
print("URL could not be decoded with utf-8 format")
print("Attempting to decode with utf-16 format")
content = response.content.decode("utf-16")

if response.history:
print("URL redirected more than 0 times:")
for history in response.history:
Expand Down
Loading