Closed Ayushk4 closed 5 years ago
@Ayushk4 Can you use requests-html
instead of using bs4
?
@kshitij10496 I have updated the script. Now it requires neither of those. I will push the changes to remote soon.
@kshitij10496 Please look at the code now, I have made the necessary edits.
@Ayushk4 The ERP login feature is supposed to be used by the scrapping scripts, isn't it? If that is the case, it makes sense to write it as a package rather than a script.
Also, can you document each function using docstrings and define the global variables/constants (URLs) in a separate .py file for convenience?
Let me know if you face any question.
cc @icyflame @themousepotato
@kshitij10496 Sure, I will be working on it. :smile:
@Ayushk4 Any updates on this? 😄
Ping @Ayushk4
@themousepotato @kshitij10496 No updates yet :disappointed:. I will resume working on it, on Thursday.
Suggested Reading: https://docs.python-guide.org/writing/structure/#structuring-your-project
@kshitij10496 Can you tell the reason you prefer a package, its not even hundred lines of code? Also, can you explain the difference between script and package with respect to this case.
If a piece of code is generic enough to be used at multiple places, IMHO it should be structured as a package. The lines of code should not matter as long as the functionality is useful. Even if you implement a generic sum
function, you should package it. This is just a case of programming aesthetics.
For our case, I believe you know that we are currently using 2 scrapping scripts for populating faculty information and course information. In the future, we would have to implement other scrapping scripts as well (e.g grade distribution for Kronos). Rather running two scripts sequentially, one for getting sessionID and one for the actual scrapping work, we should make the problem of login trivial once and for all. Also, I think we should not be writing a "login" function for every scrapping script we write. The code should be DRY and follow the Single Responsibility Principle. Thus, a utility package with all the niceties would be wonderful. Does this make sense?
Think of legos - plug and play!
ping @kshitij10496
Ping @kshitij10496 Can you review this? I believe that the docstrings may need some work, please suggest me regarding the same.
@kshitij10496 Can you give suggestions regarding docstrings? Can you review the error handling part?
Ping @kshitij10496 , all the requested changes have been made.
Looks good! Did you test it locally?
Were you able to get any data(such as student timetable) using the tokens generated he
@kshitij10496 Using the academicToken obtained, I was able to extract data for wimp.
Merging this in!
Refers #1