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
99callgrind.out.profile
1010.venv
1111test.py
12+ test_bruteforce.py
1213test.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(
1919
2020 is_logged_into_drexel_connect = False
2121 failiure_count = 0
22+ reset_period = 1 # seconds
2223 while not is_logged_into_drexel_connect :
24+ reset_period *= 2
2325 try :
2426 session = login .login_with_drexel_connect (session )
2527 if "shib_idp_session" in session .cookies :
@@ -28,12 +30,17 @@ def scrape(
2830 except Exception :
2931 print ("Error logging in to Drexel Connect: " )
3032 print (traceback .format_exc ())
31- print ("Trying again..." )
33+ print (f "Trying again in { reset_period } seconds ..." )
3234
3335 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 )
3744
3845 data : dict [str , dict [str , Any ]] = {}
3946
You can’t perform that action at this time.
0 commit comments