Python Script to Retrieve Classroom Usage Data from NEPU JWCWX
This Python script uses the 'requests' library to make a GET request to the 'http://jwcwx.nepu.edu.cn/free-class-room/classroomUsedData' endpoint on the NEPU JWCWX website. The script retrieves data about classroom usage for a specific classroom, building, day of the week, and course time. It includes a 'JSESSIONID' cookie for authentication and prints the response in JSON format.
import requests
cookies = {
'JSESSIONID': '979EB8A4FB45297AA14D52989E787062',
}
coursetime = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
response = requests.get('http://jwcwx.nepu.edu.cn/free-class-room/classroomUsedData?jwCode=内容:181201&buildCode=01&roomCode=0101&weekDay=2&courseTime=' + coursetime[0], cookies=cookies)
print(response.json())
The code defines a 'cookies' dictionary containing the 'JSESSIONID' cookie value and a 'coursetime' list containing the possible course times. It then constructs the URL with the necessary parameters, including the 'jwCode', 'buildCode', 'roomCode', 'weekDay', and 'courseTime' values. The 'requests.get' function makes the GET request to the specified URL with the provided cookies. Finally, the 'response.json()' method extracts and prints the JSON data from the response.
原文地址: https://www.cveoy.top/t/topic/nenj 著作权归作者所有。请勿转载和采集!