kshitij10496 / hercules

The mighty hero helping you build projects on top of IIT Kharagpur's academic data
https://hercules-10496.herokuapp.com/api/v1/static/index.html
MIT License
34 stars 18 forks source link

Add script to login to erp during runtime while extracting the data. #1

Closed Ayushk4 closed 5 years ago

Ayushk4 commented 5 years ago

As of now, we have to pass the cookie as an argument while running the extract data scripts.

We can use a web scraper /web driver ( selenium or robobrowser ) and login into erp while running the script. This will prompt the user to input the roll number and the password and the security question. Note that this won't be storing any password or other details that were input This will save us the trouble of having to log in and then copy paste the cookies.

This will make it easier for running the scripts to update every sem.

kshitij10496 commented 5 years ago

Sounds like a good idea. 😃

I think we should have capabilities to perform ERP login in hercules in the future. Since the code is open-sourced, the user shouldn’t be afraid/paranoid to share their credentials. We had a similar terminal based credentials sharing system in gyft. The advantages provided by this login service would be wholesome in itself with people easily able to their personalised data on ERP through a more user-friendly API.

However, this is just my personal opinion and I'm very much interested in listening to what others' have to say before we start implementing anything here. 😅

cc KGP Community, to name a few: @amrav @hargup @icyflame @ghostwriternr

icyflame commented 5 years ago

@kshitij10496 Good reasoning there. 👍 As long as the script that the user is running is short and can be inspected by them, asking them to enter their password is completely fine! 🙂

themousepotato commented 5 years ago

@kshitij10496 Making an environment variable for the method will let the user choose his/her way of feeding either the credentials or the cookies IMHO.

kshitij10496 commented 5 years ago

@kshitij10496 Making an environment variable for the method will let the user choose his/her way of feeding either the credentials or the cookies IMHO.

That's a good idea! At the moment, the scripts expect a JSESSIONID as a positional argument for scrapping. To be honest, it would be wonderful if we can have the best of both the worlds! 🤔

$ python scrapper.py JSESSIONID -o results.json # scrapping with Session ID

$ python scrapper.py -o results.json # scrapping with login
Enter your Roll No.
Enter your Password
[Security Question]
Enter your Answer:
kshitij10496 commented 5 years ago

Closed by #2