File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 17
17
college_code = "CI"
18
18
19
19
# Warn users if they have missing required environment variables
20
- environ_help_url = "https://github.com/Zohair-coder/drexel-scraper?tab=readme-ov-file#authentication"
20
+ environ_help_url = (
21
+ "https://github.com/Zohair-coder/drexel-scraper?tab=readme-ov-file#authentication"
22
+ )
23
+
24
+
21
25
def get_environ (key : str , required : bool = True ) -> str :
22
26
if key in os .environ :
23
27
return os .environ [key ]
24
28
elif required :
25
- print (f"{ key } is missing from your environment variables and is required to run this script. See { environ_help_url } for more information and help." )
29
+ print (
30
+ f"{ key } is missing from your environment variables and is required to run this script. See { environ_help_url } for more information and help."
31
+ )
26
32
sys .exit (1 )
27
33
else :
28
34
return ""
29
35
36
+
30
37
# Drexel Connect Credentials
31
38
drexel_username = get_environ ("DREXEL_USERNAME" )
32
39
drexel_password = get_environ ("DREXEL_PASSWORD" )
Original file line number Diff line number Diff line change @@ -16,9 +16,13 @@ def get_token(secret: str) -> str:
16
16
h = (struct .unpack (">I" , h [o : o + 4 ])[0 ] & 0x7FFFFFFF ) % 1000000
17
17
return str (h ).zfill (6 )
18
18
19
+
19
20
if __name__ == "__main__" :
20
21
import config
22
+
21
23
if config .drexel_mfa_secret_key is not None :
22
24
print (get_token (config .drexel_mfa_secret_key ))
23
25
else :
24
- print (f"Please set your MFA secret key to run this script. See { config .environ_help_url } for more information and help" )
26
+ print (
27
+ f"Please set your MFA secret key to run this script. See { config .environ_help_url } for more information and help"
28
+ )
You can’t perform that action at this time.
0 commit comments