def freeBook(self, start_time, end_time, seat_id, date, multiply=True): # 预约座位 if multiply: start = float(start_time) * 60 end = float(end_time) * 60 post_data = { 'startTime': str(int(start)), 'endTime': str(int(end)), 'seat': seat_id, 'date': date } r = self.requests('POST', self.api["freeBook"], data=post_data) return parse_json(r.text)
def reservations(self): # 查看预约 r = self.requests('GET', self.api['reservations']) return parse_json(r.text)
def getToken(self): # 获取token r = self.requests_call("GET", self.api['token'].format(self.ac, self.pw)) return parse_json(r.text)
def cancelRes(self, res_id): r = self.requests('GET', self.api['cancelRes'].format(res_id)) return parse_json(r.text)
def history(self, page=1, count=10): # 获取预约历史 # 1是页数从1开始 10为每页显示个数 url = self.api['history'].format(page, count) r = self.requests('GET', url) return parse_json(r.text)
def checkIn(self): # 签到 r = self.requests('GET', self.api['checkIn']) return parse_json(r.text)
def layoutByDate(self, room_id, date): url = self.api['layoutByDate'].format(room_id, date) r = self.requests('GET', url) return parse_json(r.text)
def seatEndTime(self, seat_id, date, start_time): # 结束时间 url = self.api['seatEndTime'].format(seat_id, date, start_time) r = self.requests('GET', url) return parse_json(r.text)
def seatStartTime(self, seat_id, date): # 可开始时间 url = self.api['seatStartTime'].format(seat_id, date) r = self.requests('GET', url) return parse_json(r.text)
def roomStats(self, building_id): # 获取楼层信息 r = self.requests("GET", self.api['roomStats'].format(building_id)) return parse_json(r.text)
def filters(self): # 图书馆信息 r = self.requests('GET', self.api['filters']) return parse_json(r.text)
def user(self): # 用户信息 r = self.requests('GET', self.api['user']) return parse_json(r.text)