Refactoring
This commit is contained in:
@ -93,6 +93,7 @@ async def checkUser_async():
|
||||
"""
|
||||
# noinspection DuplicatedCode
|
||||
async with httpx.AsyncClient() as s:
|
||||
# noinspection DuplicatedCode
|
||||
content = (f'usrname={fmail}&pass={fpw}&ARGUMENTS=clino%2Cusrname%2Cpass%2Cmenuno%2Cmenu_type%2Cbrowser'
|
||||
f'%2Cplatform&APPNAME=CampusNet&PRGNAME=LOGINCHECK')
|
||||
response = await s.post(url=url, headers=headers, content=content)
|
||||
@ -167,6 +168,7 @@ async def getResults_async(token, cookie, resl):
|
||||
async with httpx.AsyncClient() as s:
|
||||
response = await s.get(url=url + "?APPNAME=CampusNet&PRGNAME=COURSERESULTS&ARGUMENTS=-N" + token +
|
||||
",-N000307," + ",-N" + resl, headers=headers)
|
||||
# noinspection DuplicatedCode
|
||||
html = BeautifulSoup(response.content.decode("utf-8"), 'lxml')
|
||||
table = html.find('table', attrs={"class": "nb list"})
|
||||
body = table.find("tbody")
|
||||
@ -183,7 +185,7 @@ async def getResults_async(token, cookie, resl):
|
||||
col[2] = i
|
||||
i += 1
|
||||
vorlist += [col[1:4]]
|
||||
|
||||
# noinspection DuplicatedCode
|
||||
extrakurse = await asyncio.gather(*tasks, return_exceptions=True)
|
||||
|
||||
for i in vorlist:
|
||||
@ -192,6 +194,7 @@ async def getResults_async(token, cookie, resl):
|
||||
i[e] = extrakurse[i[e]]
|
||||
return vorlist[:-1]
|
||||
|
||||
|
||||
# noinspection DuplicatedCode
|
||||
async def getPruefung_async(s, url):
|
||||
response = await s.get("https://dualis.dhbw.de" + url, headers=headers)
|
||||
|
||||
Reference in New Issue
Block a user