hmc-portal2 / hmc-scheduler

A tool to help you arrange your classes for next semester.
https://csearch.yancey.io/
MIT License
1 stars 3 forks source link

Some times are missing #3

Closed raxod502 closed 7 years ago

raxod502 commented 7 years ago

For example, ENGR079 HM has no schedule and cannot be added to the schedule. Furthermore, there's no error message to indicate this; the scheduler acts like the class was added successfully when in fact it was not.

g-rocket commented 7 years ago

There are some times missing due to API problems: see bb2915c. However, I'm not seeing any problems with that class in particular. Could you try deleting it, reloading, and trying again?

raxod502 commented 7 years ago

Well, now the times are present for that class. It looks like that is because courses.json was updated. How is that file generated?

g-rocket commented 7 years ago

@raxod502 I have a script that pulls it from the portal lingk API. Email mark ashley if you want access. Here's the script, with credentials redacted:

#!/bin/bash
newline=$'\n'

entrypoint="https://www.lingkapis.com"
apikey="REDACTED"
secret="REDACTED"

service="/v1/harveymudd/coursecatalog/ps/datasets/coursecatalog"
querystring="$1"
method="GET"
methodlower="get"

timestamp="$(date -u '+%a, %d %b %Y %T %Z')"
message="date: ${timestamp}${newline}(request-target): ${methodlower} ${service}"
signature=$(printf "${message}" | openssl sha1 -hmac "${secret}" -binary | base64)
signatureurl=$(python -c "import urllib; print urllib.quote('''${signature}''', ''' ''')")
url="${entrypoint}${service}${querystring}"
dateheader="Date: ${timestamp}"
authheader="Authorization: Signature keyId=\"${apikey}\",algorithm=\"hmac-sha1\",headers=\"date (request-target)\",signature=\"${signatureurl}\""

printf 'lingkCallback('
curl -s -S -H "${dateheader}" -H "${authheader}" "${url}"
printf ')\n'