get_all_user_data fails with a 10103 error and no message
moreside opened this issue · 3 comments
I started receiving an unrecognized error after attempting to fetch user data using accounts generated with your account creator tool. It occasionally works, but other times it responds with a 10103 error which has no associated message:
Traceback (most recent call last):
File "c:\Users\Will\Desktop\projects\genshin-impact-spiral-abyss-stats\test.py", line 14, in <module>
user_data = get_all_user_data(606355280)
File "C:\Python39\lib\site-packages\genshinstats\genshinstats.py", line 232, in get_all_user_data
data = get_user_stats(uid, cookie)
File "C:\Python39\lib\site-packages\genshinstats\genshinstats.py", line 181, in get_user_stats
data = fetch_endpoint(
File "C:\Python39\lib\site-packages\genshinstats\genshinstats.py", line 167, in fetch_endpoint
return _request(method, url, cookies=cookie, **kwargs)
File "C:\Python39\lib\site-packages\genshinstats\utils.py", line 109, in inner
return func(*args, **kwargs)
File "C:\Python39\lib\site-packages\genshinstats\genshinstats.py", line 140, in _request
raise_for_error(data)
File "C:\Python39\lib\site-packages\genshinstats\errors.py", line 80, in raise_for_error
raise error
genshinstats.errors.GenshinStatsException: 10103 Error ()
Here's a minimal example of the code I'm using. accounts.json
is untouched after it's generated by the account creator.
from genshinstats import get_all_user_data, set_cookies
from json import load
def load_json(filename):
with open(filename) as json_file:
return load(json_file)
accounts = load_json("accounts.json")
cookies = [account["cookies"] for account in accounts]
set_cookies(*cookies)
user_data = get_all_user_data(123456789)
print(user_data)
What does this error mean?
Oh looks like my account creator has a bug then, 10103 means your account exists but doesn't have a hoyolab username. I'll try and see if I can make some fix with how the hoyolab accounts are made.
I believe I've spotted the problem. When I run the account creator, at the end of the create_hoyolab_account
stage it refreshes the page before hoyolab can register the account properly. I added a simple time.sleep
before the refresh at the end of that function, and the accounts it generates are now all usable. So yeah, no problems on genshinstats's end, although mapping that error code to a message would probably be useful.
Thanks, I thought it was caused by something completely different. I'm sorry it took so long, I was a bit busy lately.