Skip to content

Commit

Permalink
Curl updated csv to endpoint, API doesn't work?
Browse files Browse the repository at this point in the history
  • Loading branch information
RichtXO committed Mar 5, 2022
1 parent 7098d19 commit eb1545b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 55 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/prod-update.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions rpi_data/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ RUN chmod +x /etc/cron.d/cronjob && \
chmod +x /usr/src/automate-semesters.sh && \
touch /var/log/cron.log

RUN apt update && apt install cron -y && \
pip3 install --no-cache-dir -r requirements.txt
RUN apt update && apt install cron curl -y && \
pip install --no-cache-dir -r requirements.txt
CMD cron && tail -f /var/log/cron.log
17 changes: 10 additions & 7 deletions rpi_data/automate-semesters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ spring() {
exitCode=$?
if [ ${exitCode} == 0 ]
then
export SEMESTER="SPRING ${year}"
SOURCE_URL=${source_url} DEST=p0.csv HEADERS=True python3 ./modules/rpi-parse.py
cat p* > spring-${year}.csv
rm -rf p*.csv
export SEMESTER="SPRING ${year}"
SOURCE_URL=${source_url} DEST=p0.csv HEADERS=True python3 ./modules/rpi-parse.py
cat p* > spring-${year}.csv
rm -rf p*.csv
curl -X POST -H "Content-Type: multipart/form-data" -F "isPubliclyVisible=on" -F "file=spring-${year}" -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0" $API_ENDPOINT
else
echo "The requested Spring SIS page returned error 404." >&2
echo "The requested Spring SIS page returned error 404." >&2
fi
}

Expand All @@ -26,13 +27,14 @@ summer() {
python3 ./website_checker.py ${source_url_a} ${source_url_b} ${source_url}
exitCode=$?
if [ ${exitCode} == 0 ]
then
then
export SEMESTER="SUMMER ${year}"
SOURCE_URL=${source_url_a} HEADERS=True DEST=p0.csv python3 ./modules/rpi-parse.py
SOURCE_URL=${source_url_b} HEADERS=False DEST=p1.csv python3 ./modules/rpi-parse.py
SOURCE_URL=${source_url_c} HEADERS=False DEST=p2.csv python3 ./modules/rpi-parse.py
cat p* > summer-${year}.csv
rm -rf p*.csv
curl -X POST -H "Content-Type: multipart/form-data" -F "isPubliclyVisible=on" -F "file=summer-${year}" -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0" $API_ENDPOINT
else
echo "A requested Summer SIS page returned error 404." >&2
fi
Expand All @@ -46,11 +48,11 @@ fall() {
exitCode=$?
if [ ${exitCode} == 0 ]
then
echo "Fall"
export SEMESTER="FALL ${year}"
SOURCE_URL=${source_url} DEST=p0.csv HEADERS=True python3 ./modules/rpi-parse.py
cat p* > fall-${year}.csv
rm -rf p*.csv
curl -X POST -H "Content-Type: multipart/form-data" -F "isPubliclyVisible=on" -F "file=fall-${year}" -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0" $API_ENDPOINT
else
echo "A requested Fall SIS page returned error 404." >&2
fi
Expand All @@ -59,6 +61,7 @@ fall() {

MONTH=$(date +%m)
YEAR=$(date +%Y)
API_ENDPOINT=https://yacs_web/api/bulkCourseUpload
if [[ ${MONTH} -ge 1 && ${MONTH} -lt 5 ]]
then
spring ${YEAR}
Expand Down

0 comments on commit eb1545b

Please sign in to comment.