🐛 Fix authserver https

This commit is contained in:
xtaodada 2023-09-10 23:01:55 +08:00
parent 5de41db295
commit 35e34caa35
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
4 changed files with 17 additions and 5 deletions

View File

@ -22,7 +22,7 @@ class Client(Methods):
self.cookie = cookie
self.cookie_file_path = cookie_file_path
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.cookies = Cookies()
self.request = AsyncClient(timeout=timeout)

View File

@ -13,9 +13,9 @@ class LoginWebVPN:
url = "https://webvpn.cqwu.edu.cn"
ehall_html = await self.request.get(url, follow_redirects=True)
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(
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)

View File

@ -1,4 +1,4 @@
from typing import List
from typing import List, Dict
from pydantic import BaseModel
@ -19,3 +19,15 @@ class AiCourse(BaseModel):
@property
def second_key(self):
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)))))
}

View File

@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup(
name="cqwu", # 用自己的名替换其中的YOUR_USERNAME_
version="0.0.15", # 包版本号,便于维护版本
version="0.0.16", # 包版本号,便于维护版本
author="omg-xtao", # 作者,可以写自己的姓名
author_email="xtao@xtaolink.cn", # 作者联系方式,可写自己的邮箱地址
description="A cqwu ehall client.", # 包的简述