Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUSession.GPA() no longer works #10

Open
AparaV opened this issue May 26, 2017 · 4 comments
Open

CUSession.GPA() no longer works #10

AparaV opened this issue May 26, 2017 · 4 comments

Comments

@AparaV
Copy link
Contributor

AparaV commented May 26, 2017

Because of some very recent changes to myCUinfo system, this line attempts to convert some non-numeric characters to float. And the program breaks there.

I did some checking and this is what the webpage looks like now (5/26/2017):
image

And this is the source code for the radio buttons and the continue button (click to expand):
image
image

These actions are clearly JavaScript driven. Since (correct me if I'm wrong about this) requests cannot carry out JavaScript commands, it looks like we need to look at another package like selenium to do this for us.

Here is the website for quick access (you might need to login)

What do you think should be done?

@mguida22
Copy link
Contributor

I don't think we need to use selenium, but it might make life easier.

I think we can craft our own response here, following the format of the one they make when switching terms. This a bit convoluted so bear with me... 🙃

We can get the id of the term we want by looking at the value attribute of the element we want to 'click'.

<input
  ...
  class="PSRADIOBUTTON"
  id="SSR_DUMMY_RECV1$sels$4$$0"
  value="4">

Following the request (using Chrome's network tab) they make when you click the 'continue' button, we can see a few important details:

request headers

POST /psc/csprod/UCB2/HRMS/c/SA_LEARNER_SERVICES.SSR_SSENRL_GRADE.GBL HTTP/1.1
Host: isis-cs.prod.cu.edu
Connection: keep-alive
Content-Length: 676
Origin: https://isis-cs.prod.cu.edu
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Content-Type: application/x-www-form-urlencoded
...

form data

ICAJAX=1
ICNAVTYPEDROPDOWN=0
ICType=Panel
ICElementNum=0
ICStateNum=18
ICAction=DERIVED_SSS_SCT_SSR_PB_GO
_gs_page=SSR_SSENRL_TERM
_gs_cs=
ICXPos=0
ICYPos=586
ResponsetoDiffFrame=-1
TargetFrameName=None
FacetPath=None
ICFocus=
ICSaveWarningFilter=0
ICChanged=-1
ICAutoSave=0
ICResubmit=0
ICSID=EbB7njqZXKtZ53dq
ICActionPrompt=false
ICBcDomData=undefined
ICFind=
ICAddCount=
ICAPPCLSDATA=
SSR_DUMMY_RECV1$sels$4$$0=4       <----------- the term id?
ptus_defaultlocalnode=ICSPRD
ptus_dbname=ICSPRD
ptus_portal=UCB2
ptus_node=HRMS
ptus_workcenterid=
ptus_componenturl=https://isis-cs.prod.cu.edu/psp/csprod/UCB2/HRMS/c/SA_LEARNER_SERVICES.SSR_SSENRL_GRADE.GBL

So once we grab the term_id, then we need to craft a request resembling the one they make, but replacing

SSR_DUMMY_RECV1$sels$4$$0=4

with one of the form

SSR_DUMMY_RECV1$sels$<term_id>$$0=<term_id>

Hopefully this helps a little! @AparaV @719ben let me know what you guys think, maybe I can put together a fix for it next week if this seems like it'll work

@AparaV
Copy link
Contributor Author

AparaV commented May 26, 2017

@mguida22 I think this fix will definitely work. Thanks for the quick reply!

@biw
Copy link
Owner

biw commented May 27, 2017

@AparaV just as a general rule for this repo, nothing should be done using anything other than requests. Every request can and should be traced back, even if called by javascript. 😃
Disabling javascript in the browser or using an ad blocker that lists out requests is a great way to figure out the underlying HTTP request.

@AparaV
Copy link
Contributor Author

AparaV commented May 27, 2017

@719ben got it! It didn't strike me to track down the HTTP request earlier, which was why I suggested using selenium.
I'll remember that (use only requests) next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants