Skip to content

fix: 修改MTeam API部分请求头内容类型为application/x-www-form-urlencoded,并修正数值转换为浮点数… #823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/apis/mteam_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_mt_connection(site_info):
start_time = datetime.now()
site_url = MTeamApi.parse_api_domain(site_info.get("signurl")) + "/api/system/hello"
headers = {
"Content-Type": "application/json; charset=UTF-8",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": site_info.get("ua"),
"x-api-key": site_info.get("apikey"),
"Accept": "application/json"
Expand Down
22 changes: 11 additions & 11 deletions app/sites/siteuserinfo/mteam_torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _mt_get_sys_roles(self):
res = RequestUtils(
headers={
'x-api-key': self._apikey,
"Content-Type": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": self._ua,
"Accept": "application/json"
},
Expand All @@ -80,13 +80,13 @@ def _mt_get_sys_roles(self):
sysrole._nameEng = result.get("nameEng")
sysrole._image = result.get("image")
sysrole._color = result.get("color")
sysrole._readAccess = int(result.get("readAccess"))
sysrole._classUp = int(result.get("classUp"))
sysrole._registerWeek = int(result.get("registerWeek"))
sysrole._downloaded = int(result.get("downloaded"))
sysrole._shareRate = int(result.get("shareRate"))
sysrole._shareRateLimit = int(result.get("shareRateLimit"))
sysrole._sortPoint = int(result.get("sortPoint"))
sysrole._readAccess = int(float(result.get("readAccess")))
sysrole._classUp = int(float(result.get("classUp")))
sysrole._registerWeek = int(float(result.get("registerWeek")))
sysrole._downloaded = int(float(result.get("downloaded")))
sysrole._shareRate = int(float(result.get("shareRate")))
sysrole._shareRateLimit = int(float(result.get("shareRateLimit")))
sysrole._sortPoint = int(float(result.get("sortPoint")))
g_sys_role_list.append(sysrole)
log.info(f"【MTeamUserInfo】 获取馒头系统角色成功,共有{len(g_sys_role_list)}个角色")
elif res is not None:
Expand All @@ -105,7 +105,7 @@ def _mt_getprofile(self):
res = RequestUtils(
headers={
'x-api-key': self._apikey,
"Content-Type": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": self._ua,
"Accept": "application/json"
},
Expand Down Expand Up @@ -156,9 +156,9 @@ def _parse_user_base_info(self, html_text):
# 积分
self.bonus = memberCount.get("bonus", 0)
# 上传
self.upload = int(memberCount.get("uploaded", 0))
self.upload = int(float(memberCount.get("uploaded", 0)))
# 下载
self.download = int(memberCount.get("downloaded", 0))
self.download = int(float(memberCount.get("downloaded", 0)))
# 拉取做种信息
self._mt_get_seeding_info()
# 拉取下载信息
Expand Down