Skip to content

Commit

Permalink
Added an error for when you don't have a hoyolab account created.
Browse files Browse the repository at this point in the history
Requested in #28 (comment)
  • Loading branch information
thesadru committed Aug 16, 2021
1 parent 457ba5d commit d6d6efb
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ This project can be freely downloaded and distributed.
Crediting is appreciated.

# CHANGELOG
## 1.4.6.1
- Added an error for when you don't have a hoyolab account created.
## 1.4.6
- Added several new log related endpoints
- get_primogem_log, get_resin_log, get_crystal_log
Expand Down
1 change: 1 addition & 0 deletions genshinstats/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def raise_for_error(response: dict):
-1: AccountNotFound('Could not find user; uid may not be valid.'),
-10002:AccountNotFound('Cannot get rewards info. Account has no game account binded to it.'),
-108: GenshinStatsException('Language is not valid.'),
10103: NotLoggedIn('Cookies are correct but do not have a hoyolab account bound to them.'),
# code redemption
-2003: CodeRedeemException('Invalid redemption code'),
-2017: CodeRedeemException('Redemption code has been claimed already.'),
Expand Down
2 changes: 1 addition & 1 deletion genshinstats/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _get_transactions(
data = fetch_transaction_endpoint(
endpoint,
authkey=authkey,
params=dict(size=page_size, end_id=end_id)
params=dict(size=min(page_size, size), end_id=end_id)
)["list"]
data = prettify_trans(data, _get_reasons(lang))
yield from data
Expand Down
2 changes: 1 addition & 1 deletion genshinstats/wishes.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def get_wish_history(
data = fetch_gacha_endpoint(
"getGachaLog",
authkey=authkey,
params=dict(gacha_type=banner_type, size=page_size, end_id=end_id, lang=lang)
params=dict(gacha_type=banner_type, size=min(page_size, size), end_id=end_id, lang=lang)
)['list']
data = prettify_wish_history(data, banner_name)
yield from data
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="genshinstats",
version="1.4.6",
version="1.4.6.1",
author="thesadru",
packages=["genshinstats"],
description="A python library that can get the stats of Genshin Impact players using Mihoyo's API.",
Expand Down
2 changes: 1 addition & 1 deletion tests/local/test_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_transactions():

def test_current_resin():
try:
resin = gs.current_resin(datetime(2021, 8, 12), 160)
resin = gs.current_resin(datetime(2021, 8, 14), 160)
except ValueError:
warnings.warn("current_resin has failed - this might have been "
"because an entry is wrong so only a warn is given.")
Expand Down

0 comments on commit d6d6efb

Please sign in to comment.