From ed846b58519bf34efeca73bfc985628b393c7070 Mon Sep 17 00:00:00 2001 From: RBAmeto <46624927+RBAmeto@users.noreply.github.com> Date: Mon, 22 May 2023 00:28:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E9=80=82=E9=85=8D=E6=98=9F?= =?UTF-8?q?=E7=A9=B9=E9=93=81=E9=81=93=E7=89=B9=E6=AE=8A=E6=83=85=E5=86=B5?= =?UTF-8?q?=20(#14)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 适配星穹铁道过码 * 🚨 `pre-commit-ci`修复格式错误 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- gsuid_core/utils/api/mys/request.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gsuid_core/utils/api/mys/request.py b/gsuid_core/utils/api/mys/request.py index 8bed492..39f426f 100644 --- a/gsuid_core/utils/api/mys/request.py +++ b/gsuid_core/utils/api/mys/request.py @@ -202,12 +202,20 @@ class BaseMysApi: raw_data = {} for _ in range(2): if 'Cookie' in header and header['Cookie'] in self.chs: - # header['x-rpc-challenge']=self.chs.pop(header['Cookie']) + if self.is_sr: + header['x-rpc-challenge'] = self.chs.pop( + header['Cookie'] + ) + if isinstance(params, Dict): + header['DS'] = get_ds_token( + '&'.join( + [f'{k}={v}' for k, v in params.items()] + ) + ) header['x-rpc-challenge_game'] = '6' if self.is_sr else '2' header['x-rpc-page'] = ( '3.1.3_#/rpg' if self.is_sr else '3.1.3_#/ys' ) - async with client.request( method, url=url,