thesadru / genshin.py

API wrapper for HoYoLAB/Miyoushe API built on asyncio and pydantic.
https://thesadru.github.io/genshin.py
MIT License
405 stars 74 forks source link

genshin.errors.GenshinException: [10104] Upon attempting to get the notes for another user. #33

Closed emredesu closed 2 years ago

emredesu commented 2 years ago

As the title suggests, attempting to use client.get_notes({uidOfSomeoneElse}) on another user that has a publicly open battle chronicle returns this exception. Is this because Hoyolab doesn't allow you to get notes for other users? If that's the case, the description "Tried to use a beta feature in an invalid context." doesn't sound correct (unless this is a beta feature that's actually being worked on, in that case go you!).

thesadru commented 2 years ago

The error used to say something along those lines but in Chinese. Now it returns an empty string so I'm guessing Hoyo no longer wants to support that. Since there are no API docs I am constantly forced to guess the intentions of the developers.

The error should definitely be changed but client.get_notes isn't supposed to be used with any arguments anyways (it's there just for consistency) so you should never get that error in the first place.

mchubby commented 2 years ago

For me it ping-pongs between

GET https://bbs-api-os.hoyolab.com/game_record/genshin/api/dailyNote?role_id=(foreign uid)&server=os_euro

and

DEBUG:genshin.client.components.base:POST https://bbs-api-os.hoyolab.com/game_record/card/wapi/changeDataSwitch
{"switch_id":3,"is_public":true,"game_id":2}

on v1.2.1

while going through a browser xhr the code is

{"data":null,"message":"Data is not public for the user","retcode":10102}

(edit: indeed returns genshin.errors.GenshinException: [10104] Tried to use a beta feature in an invalid context. for an account which has the real-time log enabled)

probably related to https://github.com/thesadru/genshin.py/commit/d0b9e34fc1f621bb785408ad58134db15d901c33 and #32

GauravM512 commented 2 years ago

Are you using the same account cookies for which you are getting the notes

mchubby commented 2 years ago

Well, no, in the context of this ticket the attempt is to read someone else's notes.

But the point should stand, maybe add some counter to avoid the infinite looping?

thesadru commented 2 years ago

What I'd do is a new parameter like force which would determine whether enabling the notes should be allowed.