mirror of
https://github.com/cqwu-ehall/cqwu-ehall.git
synced 2024-11-22 11:01:20 +00:00
🐛 Fix authserver https
This commit is contained in:
parent
5de41db295
commit
35e34caa35
@ -22,7 +22,7 @@ class Client(Methods):
|
|||||||
self.cookie = cookie
|
self.cookie = cookie
|
||||||
self.cookie_file_path = cookie_file_path
|
self.cookie_file_path = cookie_file_path
|
||||||
self.host = "http://ehall.cqwu.edu.cn"
|
self.host = "http://ehall.cqwu.edu.cn"
|
||||||
self.auth_host = "http://authserver.cqwu.edu.cn"
|
self.auth_host = "https://authserver.cqwu.edu.cn"
|
||||||
self.web_ehall_path = ""
|
self.web_ehall_path = ""
|
||||||
self.cookies = Cookies()
|
self.cookies = Cookies()
|
||||||
self.request = AsyncClient(timeout=timeout)
|
self.request = AsyncClient(timeout=timeout)
|
||||||
|
@ -13,9 +13,9 @@ class LoginWebVPN:
|
|||||||
url = "https://webvpn.cqwu.edu.cn"
|
url = "https://webvpn.cqwu.edu.cn"
|
||||||
ehall_html = await self.request.get(url, follow_redirects=True)
|
ehall_html = await self.request.get(url, follow_redirects=True)
|
||||||
self.web_ehall_path = self.get_web_vpn_host(ehall_html.url) # noqa
|
self.web_ehall_path = self.get_web_vpn_host(ehall_html.url) # noqa
|
||||||
await self.oauth("http://authserver.cqwu.edu.cn/authserver/login?service=https://clientvpn.cqwu.edu.cn/enlink/api/client/callback/cas")
|
await self.oauth("https://authserver.cqwu.edu.cn/authserver/login?service=https://clientvpn.cqwu.edu.cn/enlink/api/client/callback/cas")
|
||||||
auth_html = await self.request.get(
|
auth_html = await self.request.get(
|
||||||
f"{self.web_ehall_path}/login", follow_redirects=True
|
f"{self.web_ehall_path}/login", follow_redirects=True
|
||||||
)
|
)
|
||||||
if web_auth_path := self.get_web_vpn_host(auth_html.url):
|
if web_auth_path := self.get_web_vpn_host(auth_html.url, https=True):
|
||||||
await self.login_with_password(auth_host=web_auth_path)
|
await self.login_with_password(auth_host=web_auth_path)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import List
|
from typing import List, Dict
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
@ -19,3 +19,15 @@ class AiCourse(BaseModel):
|
|||||||
@property
|
@property
|
||||||
def second_key(self):
|
def second_key(self):
|
||||||
return f"{self.day}_{self.sections}"
|
return f"{self.day}_{self.sections}"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ai(self) -> Dict:
|
||||||
|
return {
|
||||||
|
"name": self.name,
|
||||||
|
"position": self.position,
|
||||||
|
"teacher": self.teacher,
|
||||||
|
"weeks": ",".join(list(map(str, self.weeks))),
|
||||||
|
"day": self.day,
|
||||||
|
"style": "",
|
||||||
|
"sections": ",".join(list(map(str, list(range(self.start_num, self.start_num + self.sections)))))
|
||||||
|
}
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="cqwu", # 用自己的名替换其中的YOUR_USERNAME_
|
name="cqwu", # 用自己的名替换其中的YOUR_USERNAME_
|
||||||
version="0.0.15", # 包版本号,便于维护版本
|
version="0.0.16", # 包版本号,便于维护版本
|
||||||
author="omg-xtao", # 作者,可以写自己的姓名
|
author="omg-xtao", # 作者,可以写自己的姓名
|
||||||
author_email="xtao@xtaolink.cn", # 作者联系方式,可写自己的邮箱地址
|
author_email="xtao@xtaolink.cn", # 作者联系方式,可写自己的邮箱地址
|
||||||
description="A cqwu ehall client.", # 包的简述
|
description="A cqwu ehall client.", # 包的简述
|
||||||
|
Loading…
Reference in New Issue
Block a user