From e5eec6fb74ea30baca3e55b150283739ecf32e23 Mon Sep 17 00:00:00 2001 From: proffapt Date: Fri, 11 Aug 2023 12:23:42 +0530 Subject: [PATCH] feat(minor): Providing developer access to ROLL_NUMBER --- README.md | 7 +++++++ src/iitkgp_erp_login/erp.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 3c277b8..cd277d7 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,13 @@ The function can also be provided with these _optional_ arguments: 1. [sessionToken](https://en.wikipedia.org/wiki/Session_ID) 2. [ssoToken](https://en.wikipedia.org/wiki/Single_sign-on) 2. It also modifies the `session` object, which now includes parameters for the logged-in session. This `session` object can be utilized for further navigation within the ERP system. +3. `ROLL_NUMBER` is made available for further usage in the following manner. + ```python + import iitkgp_erp_login.erp as erp + sessionToken, ssoToken = erp.login(headers, session) + + print('Roll Number =', erp.ROLL_NUMBER) + ```
diff --git a/src/iitkgp_erp_login/erp.py b/src/iitkgp_erp_login/erp.py index d3a8583..f5f247c 100644 --- a/src/iitkgp_erp_login/erp.py +++ b/src/iitkgp_erp_login/erp.py @@ -14,6 +14,7 @@ requests.packages.urllib3.disable_warnings(InsecureRequestWarning) logging.basicConfig(level=logging.INFO) sessionToken = "" +ROLL_NUMBER = "" class ErpLoginError(Exception): pass @@ -21,6 +22,7 @@ class ErpLoginError(Exception): def login(headers, session, ERPCREDS=None, OTP_CHECK_INTERVAL=None, LOGGING=False, SESSION_STORAGE_FILE=None): global sessionToken + global ROLL_NUMBER ssoToken = None if len(sys.argv) == 1 and sys.argv[0] == '-c': caller_file = None