Skip to content

Commit 822ffd9

Browse files
committed
nice error message
1 parent 288cc3b commit 822ffd9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"python.testing.pytestArgs": [
3+
"src"
4+
],
5+
"python.testing.unittestEnabled": false,
6+
"python.testing.pytestEnabled": true
7+
}

src/scrape.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def scrape(
2121
failiure_count = 0
2222
reset_period = 1 # seconds
2323
while not is_logged_into_drexel_connect:
24+
reset_period *= 2
2425
try:
2526
session = login.login_with_drexel_connect(session)
2627
if "shib_idp_session" in session.cookies:
@@ -29,7 +30,7 @@ def scrape(
2930
except Exception:
3031
print("Error logging in to Drexel Connect: ")
3132
print(traceback.format_exc())
32-
print("Trying again...")
33+
print(f"Trying again in {reset_period} seconds...")
3334

3435
failiure_count += 1
3536
if failiure_count > 20:
@@ -39,7 +40,6 @@ def scrape(
3940
)
4041
)
4142

42-
reset_period *= 2
4343
time.sleep(reset_period)
4444

4545
data: dict[str, dict[str, Any]] = {}

0 commit comments

Comments
 (0)