pittcsc / PittAPI

An API to easily get data from the University of Pittsburgh
https://pittapi.pittcsc.org
GNU General Public License v2.0
105 stars 30 forks source link

Incorporating new PeopleSoft JSON API in course module #138

Closed FishOfPitt116 closed 3 months ago

FishOfPitt116 commented 1 year ago
RitwikGupta commented 5 months ago

@FishOfPitt116 Can you update the README with your changes?

RitwikGupta commented 5 months ago

All of this looks broken at the moment:

>>> course.get_subject_courses(subject='CS')
Traceback (most recent call last):
  File "/Users/ritwik/opt/anaconda3/lib/python3.8/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Users/ritwik/opt/anaconda3/lib/python3.8/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/Users/ritwik/opt/anaconda3/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/Users/ritwik/opt/anaconda3/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ritwik/Documents/Git/PittAPI/pittapi/course.py", line 97, in get_subject_courses
    subject = _validate_subject(subject)
  File "/Users/ritwik/Documents/Git/PittAPI/pittapi/course.py", line 310, in _validate_subject
    if subject in _get_subject_codes():
  File "/Users/ritwik/Documents/Git/PittAPI/pittapi/course.py", line 356, in _get_subject_codes
    response = _get_subjects()
  File "/Users/ritwik/Documents/Git/PittAPI/pittapi/course.py", line 331, in _get_subjects
    return requests.get(SUBJECTS_API).json()
  File "/Users/ritwik/opt/anaconda3/lib/python3.8/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
image
FishOfPitt116 commented 5 months ago

Just updated the PeopleSoft URLs and the README to reflect the adapted methods @RitwikGupta