fix an issue that cannot make a reservation
This commit is contained in:
parent
07f78afdc4
commit
d048878e58
@ -22,6 +22,18 @@ class Mod:
|
||||
|
||||
self.ss = self.authenticate()
|
||||
|
||||
def __del__(self):
|
||||
res = self.ss.get(
|
||||
url = self.URL+"logout.action",
|
||||
params = {
|
||||
"b.schoolCd": self.CONFIG["school"],
|
||||
"senisakiCd": 4,
|
||||
})
|
||||
res.encoding = "shift_jis"
|
||||
self.calender = Calender(res.text)
|
||||
|
||||
self.logging.info("logout succeeded")
|
||||
|
||||
def cycle(self):
|
||||
if len(self.targets) == 0:
|
||||
return
|
||||
@ -30,7 +42,7 @@ class Mod:
|
||||
url = self.URL+"p04a.action",
|
||||
data = {
|
||||
"b.processCd": "A",
|
||||
"b.kamokuCd" : 0,
|
||||
"b.kamokuCd" : self.calender.params["kamokuCd"],
|
||||
"b.page" : 1,
|
||||
"b.schoolCd" : self.CONFIG["school"],
|
||||
})
|
||||
@ -62,12 +74,12 @@ class Mod:
|
||||
data = {
|
||||
"b.schoolCd" : self.CONFIG["school"],
|
||||
"b.processCd" : "V",
|
||||
"b.kamokuCd" : 0,
|
||||
"b.instructorTypeCd" : 0,
|
||||
"b.kamokuCd" : self.calender.params["kamokuCd"],
|
||||
"b.instructorTypeCd" : self.calender.params["instructorTypeCd"],
|
||||
"b.dateInformationType": date,
|
||||
"b.infoPeriodNumber" : slot,
|
||||
"b.carModelCd" : self.calender.carModel,
|
||||
"b.instructorCd" : 0,
|
||||
"b.carModelCd" : self.calender.params["carModelCd"],
|
||||
"b.instructorCd" : self.calender.params["instructorCd"],
|
||||
"b.page" : 1,
|
||||
"b.groupCd" : self.calender.group,
|
||||
})
|
||||
@ -108,6 +120,12 @@ class Calender:
|
||||
|
||||
self.avails = re.findall(RE_AVAIL_SLOT, text)
|
||||
|
||||
self.params = {}
|
||||
for name in RE_PARAMS:
|
||||
m = re.search(RE_PARAMS[name], text)
|
||||
if m is not None:
|
||||
self.params[name] = m[1]
|
||||
|
||||
def checkAvailable(self, date, slot):
|
||||
for avail in self.avails:
|
||||
if avail[0] == date and avail[1] == str(slot):
|
||||
@ -131,3 +149,14 @@ TIMETABLE = {
|
||||
RE_ALERT = re.compile(r"window\.alert\('(.*)'\)")
|
||||
RE_ERROR = re.compile(r"<.*? class=\"errorTitle\">メッセージ<\/.*?>\s*<.*? class=\"errorDisp\">(.*?)<\/.*?>", re.MULTILINE)
|
||||
RE_AVAIL_SLOT = re.compile(r"^\s*<a href=\"#\" onclick=\"sendContent\('(\d+)','(\d+)','V',document\.getElementById\('formId'\)\)\">$")
|
||||
|
||||
RE_PARAMS = {
|
||||
"kamokuCd" : None,
|
||||
"instructorTypeCd": None,
|
||||
"carModelCd" : None,
|
||||
"instructorCd" : None,
|
||||
"groupCd" : None,
|
||||
}
|
||||
for name in RE_PARAMS:
|
||||
RE_PARAMS[name] = re.compile(
|
||||
r"<input type=\"hidden\" name=\"b.{0}\" value=\"(.*?)\" id=\"".format(name))
|
||||
|
Loading…
Reference in New Issue
Block a user