Skip to content
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

在一台被米游社API屏蔽的VPS上光速签到 #7

Open
Arondight opened this issue Dec 27, 2021 · 1 comment
Open

在一台被米游社API屏蔽的VPS上光速签到 #7

Arondight opened this issue Dec 27, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@Arondight
Copy link

2021-12-26 10:58:58 INFO Preparing to send notification ...
2021-12-26 10:58:58 INFO End of process run
2021-12-26 10:58:58 INFO Preparing to get user game roles information ...
2021-12-26 10:58:58 INFO Preparing to get Yuan Shen daily note ...
Traceback (most recent call last):
  File "/app/./genshincheckinhelper/main.py", line 399, in <module>
    main()
  File "/app/./genshincheckinhelper/main.py", line 388, in main
    run_once()
  File "/app/./genshincheckinhelper/main.py", line 384, in run_once
    job2()
  File "/app/./genshincheckinhelper/main.py", line 303, in job2
    daily_note = ys.get_daily_note(i['game_uid'], i['region'])
  File "/usr/local/lib/python3.10/site-packages/genshinhelper/mihoyo.py", line 90, in get_daily_note
    response = request('get', url, headers=get_headers(with_ds=True, new_ds=True, params=payload), params=payload, cookies=self.cookie).json()
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2021-12-26 10:58:59 INFO 

这个异常没 catch

@y1ndan y1ndan added the bug Something isn't working label Dec 27, 2021
@Arondight
Copy link
Author

在被屏蔽的 IP 上访问某些 API 不会得到一个 JSON ,而是会得到一个 HTML,所以你需要在处理 JSON 的地方 catch 一个异常,详见 Arondight/Adachi-BOT#520 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants