Skip to content

Commit

Permalink
feat: auto OTP is optional while development
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Feb 5, 2025
1 parent ce77857 commit 58f3cc4
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions gyft.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ def parse_args():
"-D",
"--development",
action="store_true",
help="Automate erpcreds parsing while development",
help="Automate erpcreds parsing while development (except OTP)",
)
parser.add_argument(
"-O",
"--otp",
action="store_true",
help="Automate erpcreds parsing while development (including OTP)",
)
parser.add_argument(
"-o", "--output", help="Output file containing timetable in .ics format"
Expand Down Expand Up @@ -44,16 +50,31 @@ def main():
output_filename = args.output if args.output else "timetable.ics"

session = requests.Session()

if args.otp and not args.development:
print('ERROR: -O [--otp] must be used with -D [--development]')
return

if args.development:
import erpcreds

_, sso_token = erp.login(
headers,
session,
ERPCREDS=erpcreds,
OTP_CHECK_INTERVAL=2,
LOGGING=True,
)
if args.otp:
import erpcreds

_, sso_token = erp.login(
headers,
session,
ERPCREDS=erpcreds,
OTP_CHECK_INTERVAL=2,
LOGGING=True,
)
else:
import erpcreds

_, sso_token = erp.login(
headers,
session,
ERPCREDS=erpcreds,
LOGGING=True,
)
else:
_, sso_token = erp.login(headers, session)

Expand Down

0 comments on commit 58f3cc4

Please sign in to comment.