Created
December 10, 2021 18:07
-
-
Save ErikBoesen/e042a617832ddba47bff00d2320de484 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
r = requests.get( | |
#'https://gw.its.yale.edu/soa-gateway/course/webservice/index', | |
#'https://vm-gwprd-02.internal.yale.edu/soa-gateway/courses/webservice/v2/index', | |
'https://vm-gwprd-01.internal.yale.edu/soa-gateway/courses/webservice/v2/index', | |
params={ | |
'mode': 'json', | |
'subjectCode': 'CPSC', | |
'termCode': '202101', | |
'apikey': '', | |
} | |
) | |
print(r.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
with open('courses.json', encoding='utf-8') as f: | |
courses = json.load(f) | |
for course in courses: | |
print(course['course_code'] + ' ' + course['times_summary']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
cookies = { | |
'express:sess': 'eyJwYXNzcG9ydCI6eyJ1c2VyIjoiZWtiMzMifX0=', | |
'express:sess.sig': 'KSeYJtNqqqwDrsf_38u2MKcSsW4', | |
'ph_JBthuPpdaiJJGwHtoETN0Shc08K5b3VhSG2TweKm6nc_posthog': '%7B%22distinct_id%22%3A%22ekb33%22%2C%22%24device_id%22%3A%22179cecefed03c7-0954cc89d4b7988-455c6f-13c680-179cecefed1a16%22%2C%22%24initial_referrer%22%3A%22%24direct%22%2C%22%24initial_referring_domain%22%3A%22%24direct%22%2C%22%24referrer%22%3A%22https%3A%2F%2Fwww.coursetable.com%2F%22%2C%22%24referring_domain%22%3A%22www.coursetable.com%22%2C%22%24session_recording_enabled%22%3Afalse%2C%22%24user_id%22%3A%22ekb33%22%2C%22%24sesid%22%3A%5B1639019978852%2C%2217d9d3420382a7-06e9eb5d3d8aab8-402e2c34-13c680-17d9d342039c29%22%5D%7D', | |
} | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0', | |
'Accept': 'application/json, text/plain, */*', | |
'Accept-Language': 'en-US,en;q=0.5', | |
'Accept-Encoding': 'gzip, deflate, br', | |
'Referer': 'https://www.coursetable.com/', | |
'Origin': 'https://www.coursetable.com', | |
'DNT': '1', | |
'Sec-Fetch-Dest': 'empty', | |
'Sec-Fetch-Mode': 'cors', | |
'Sec-Fetch-Site': 'same-site', | |
'Connection': 'keep-alive', | |
} | |
response = requests.get('https://api.coursetable.com/api/static/catalogs/202201.json', headers=headers, cookies=cookies) | |
print(response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment