File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,5 @@ profile_output.pstat
9
9
callgrind.out.profile
10
10
.venv
11
11
test.py
12
+ test_bruteforce.py
12
13
test.txt
Original file line number Diff line number Diff line change
1
+ {
2
+ "python.testing.pytestArgs" : [
3
+ " src"
4
+ ],
5
+ "python.testing.unittestEnabled" : false ,
6
+ "python.testing.pytestEnabled" : true
7
+ }
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ def scrape(
19
19
20
20
is_logged_into_drexel_connect = False
21
21
failiure_count = 0
22
+ reset_period = 1 # seconds
22
23
while not is_logged_into_drexel_connect :
24
+ reset_period *= 2
23
25
try :
24
26
session = login .login_with_drexel_connect (session )
25
27
if "shib_idp_session" in session .cookies :
@@ -28,12 +30,17 @@ def scrape(
28
30
except Exception :
29
31
print ("Error logging in to Drexel Connect: " )
30
32
print (traceback .format_exc ())
31
- print ("Trying again..." )
33
+ print (f "Trying again in { reset_period } seconds ..." )
32
34
33
35
failiure_count += 1
34
- if failiure_count > 5 :
35
- raise Exception ("Failed to log in to Drexel Connect after 5 attempts" )
36
- time .sleep (1 )
36
+ if failiure_count > 8 :
37
+ raise Exception (
38
+ "Failed to log in to Drexel Connect after {} attempts" .format (
39
+ failiure_count
40
+ )
41
+ )
42
+
43
+ time .sleep (reset_period )
37
44
38
45
data : dict [str , dict [str , Any ]] = {}
39
46
You can’t perform that action at this time.
0 commit comments