Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Fix KeyError when login fails on some occasions
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkroot committed Apr 8, 2020
1 parent 04b4191 commit e306dd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ilc_scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,14 @@ def login(username, password):
except (requests.ConnectionError, requests.Timeout) as e:
print_quit(f"Connection Error {e}")
if response.status_code >= 500:
print_quit("Impartus not responding properly", 1)
print_quit("Impartus not responding properly")
elif response.status_code == 400:
print_quit("Invalid login request. Impartus changed something.")
elif response.status_code == 401:
print_quit("Invalid login credentials!")
resp = response.json()
if not resp["success"]:
print_quit("Impartus:" + resp["message"], 1)
print_quit(f"Impartus: {resp.get('message', resp)}", 1)
return resp["token"]


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ilc-scraper"
version = "0.6.2"
version = "0.6.3"
description = "A scraper for Impartus Lecture Capture videos for BITS Hyderabad"
authors = ["iamkroot <kroot.patel@gmail.com>"]
readme = "README.md"
Expand Down

0 comments on commit e306dd5

Please sign in to comment.