Also add sessionToken, ssoToken = to get the return values from erp.login. It is the only reason why this particular feature is not integrated into the login function itself. Just replace it with the text below:
import requests
import time
import erpcreds
# Importing erpcreds.py, which contains ERP credentials
import iitkgp_erp_login.erp as erp
headers = {
'timeout': '20',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/51.0.2704.79 Chrome/51.0.2704.79 Safari/537.36',
}
session = requests.Session()
print("Logging into ERP for:", creds.ROLL_NUMBER)
while True:
if not erp.session_alive(session):
_, ssoToken = erp.login(headers, session, ERPCREDS=erpcreds, LOGGING=True)
else:
print("Session is alive.")
# Traverse ERP further using ssoToken
time.sleep(2)
https://github.com/proffapt/iitkgp-erp-login-pypi/blob/5724f3d1e2d2a14955f799fa6793d74107f7b7d7/README.md?plain=1#L336 needs to be deleted :)
Also add
sessionToken, ssoToken =
to get the return values fromerp.login
. It is the only reason why this particular feature is not integrated into the login function itself. Just replace it with the text below: