Skip to content

Commit

Permalink
Merge pull request #17 from khw2ok/master
Browse files Browse the repository at this point in the history
Update url address
  • Loading branch information
Coder-Iro authored Aug 7, 2024
2 parents b160eba + 3a31560 commit 306d677
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
15 changes: 9 additions & 6 deletions comcigan/async_school.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ def trim(lis):
del lis[-1]
return lis

def prefix(n):
return str(n)[:2] if len(str(n)) == 5 else str(n)[:1]

URL = "http://112.186.226.178:4082"

URL = "http://222.106.100.23:4082"


class CONSTANT:
__slots__ = ("PREFIX", "orgnum", "daynum", "thnum", "sbnum", "BASEURL", "SEARCHURL")

async def refresh(self):
comci_resp = await AsyncRequest(f"{URL}/st")
comci_resp = await AsyncRequest(f"{URL}/st", "euc-kr")

comcigan_html = BeautifulSoup(comci_resp, "lxml")
script = comcigan_html.find_all("script")[1].contents[0]
Expand Down Expand Up @@ -120,11 +123,11 @@ async def refresh(self):
[
[
(
subjects[int(str(x)[-2:])],
long_subjects[int(str(x)[-2:])],
subjects[int(prefix(x))],
long_subjects[int(prefix(x))],
""
if int(str(x)[:-2]) >= len(teachers)
else teachers[int(str(x)[:-2])],
if int(str(x)[-2:]) >= len(teachers)
else teachers[int(str(x)[-2:])],
)
for x in filter(lambda x: str(x)[:-2], trim(oneday[1:]))
]
Expand Down
12 changes: 7 additions & 5 deletions comcigan/school.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def trim(lis):
del lis[-1]
return lis

def prefix(n):
return str(n)[:2] if len(str(n)) == 5 else str(n)[:1]

URL = "http://112.186.226.178:4082"
URL = "http://222.106.100.23:4082"

comci_resp = get(f"{URL}/st")
comci_resp.encoding = "EUC-KR"
Expand Down Expand Up @@ -95,11 +97,11 @@ def refresh(self):
[
[
(
subjects[int(str(x)[-2:])],
long_subjects[int(str(x)[-2:])],
subjects[int(prefix(x))],
long_subjects[int(prefix(x))],
""
if int(str(x)[:-2]) >= len(teachers)
else teachers[int(str(x)[:-2])],
if int(str(x)[-2:]) >= len(teachers)
else teachers[int(str(x)[-2:])],
)
for x in filter(lambda x: str(x)[:-2], trim(oneday[1:]))
]
Expand Down

0 comments on commit 306d677

Please sign in to comment.