🐛 修复可能出现的-10001 (#34)

* 修复可能出现的-10001

* 🚨 `pre-commit-ci`修复格式错误

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
RBAmeto 2023-10-18 20:25:33 +08:00 committed by GitHub
parent 97071e6965
commit 551ad5856f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,7 +207,7 @@ class BaseMysApi:
url=_URL,
method='GET',
header=HEADER,
params=params if params else {'server': server_id, 'role_id': uid},
params=params if params else {'role_id': uid, 'server': server_id},
use_proxy=True if is_os else False,
)
return data
@ -265,6 +265,22 @@ class BaseMysApi:
for _ in range(2):
print(header)
if isinstance(params, Dict):
header['DS'] = get_ds_token(
'&'.join(
[
f'{k}={v}'
for k, v in sorted(
params.items(), key=lambda x: x[0]
)
]
)
)
if isinstance(data, Dict):
header['DS'] = get_ds_token(
'',
data,
)
async with client.request(
method,
url=url,
@ -307,13 +323,10 @@ class BaseMysApi:
)
pass_header = copy.deepcopy(header)
ch = await self._upass(pass_header)
if ch == '':
return 114514
else:
header['x-rpc-challenge'] = ch
if isinstance(params, Dict):
header['DS'] = get_ds_token(
'&'.join(
[f'{k}={v}' for k, v in params.items()]
)
)
elif retcode != 0:
return retcode
else:
@ -489,7 +502,9 @@ class MysApi(BaseMysApi):
header=header,
)
async def get_header_and_vl(self, header: Dict, ch, vl, is_bbs: bool = False):
async def get_header_and_vl(
self, header: Dict, ch, vl, is_bbs: bool = False
):
header['DS'] = get_ds_token(
'',
{
@ -499,7 +514,9 @@ class MysApi(BaseMysApi):
},
)
_ = await self._mys_request(
url=self.MAPI['VERIFY_URL'] if not is_bbs else self.MAPI['BBS_VERIFY_URL'],
url=self.MAPI['VERIFY_URL']
if not is_bbs
else self.MAPI['BBS_VERIFY_URL'],
method='POST',
header=header,
data={