Module genshin.errors
Errors received from the API.
Functions
def check_for_geetest(data: dict[str, typing.Any]) ‑> None
-
Check if geetest was triggered during the request and raise an error if so.
def raise_for_retcode(data: dict[str, typing.Any]) ‑> NoReturn
-
Raise an equivalent error to a response.
game record: 10001 = invalid cookie 101xx = generic errors authkey: -100 = invalid authkey -101 = authkey timed out code redemption: 20xx = invalid code or state -107x = invalid cookies daily reward: -500x = already claimed the daily reward
Classes
class AccountNotFound (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Tried to get data with an invalid uid.
Expand source code
class AccountNotFound(GenshinException): """Tried to get data with an invalid uid.""" msg = "Could not find user; uid may be invalid."
Ancestors
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class AlreadyClaimed (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Already claimed the daily reward today.
Expand source code
class AlreadyClaimed(GenshinException): """Already claimed the daily reward today.""" retcode = -5003 msg = "Already claimed the daily reward today."
Ancestors
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class AuthkeyException (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Base error for authkeys.
Expand source code
class AuthkeyException(GenshinException): """Base error for authkeys."""
Ancestors
- GenshinException
- builtins.Exception
- builtins.BaseException
Subclasses
Class variables
var msg : str
var original : str
var retcode : int
class AuthkeyTimeout (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Authkey has timed out.
Expand source code
class AuthkeyTimeout(AuthkeyException): """Authkey has timed out.""" retcode = -101 msg = "Authkey has timed out."
Ancestors
- AuthkeyException
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class CookieException (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Base error for cookies.
Expand source code
class CookieException(GenshinException): """Base error for cookies."""
Ancestors
- GenshinException
- builtins.Exception
- builtins.BaseException
Subclasses
Class variables
var msg : str
var original : str
var retcode : int
class DailyGeetestTriggered (response: Mapping[str, Any], *, gt: str, challenge: str)
-
Geetest triggered during daily reward claim.
Expand source code
class DailyGeetestTriggered(GenshinException): """Geetest triggered during daily reward claim.""" msg = "Geetest triggered during daily reward claim." gt: str challenge: str def __init__(self, response: typing.Mapping[str, typing.Any], *, gt: str, challenge: str) -> None: self.gt = gt self.challenge = challenge super().__init__(response)
Ancestors
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var challenge : str
var gt : str
var msg : str
class DataNotPublic (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
User hasn't set their data to public.
Expand source code
class DataNotPublic(GenshinException): """User hasn't set their data to public.""" msg = "User's data is not public."
Ancestors
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class GeetestError (response: dict[str, typing.Any])
-
Geetest triggered during the battle chronicle API request.
Expand source code
class GeetestError(GenshinException): """Geetest triggered during the battle chronicle API request.""" def __init__(self, response: dict[str, typing.Any]) -> None: super().__init__(response) msg = "Geetest triggered during the battle chronicle API request."
Ancestors
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class GenshinException (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
A base genshin exception.
Expand source code
class GenshinException(Exception): """A base genshin exception.""" retcode: int = 0 original: str = "" msg: str = "" def __init__(self, response: typing.Mapping[str, typing.Any] = {}, msg: typing.Optional[str] = None) -> None: self.retcode = response.get("retcode", self.retcode) self.original = response.get("message", "") self.msg = msg or self.msg or self.original if self.retcode: msg = f"[{self.retcode}] {self.msg}" else: msg = self.msg super().__init__(msg) def __repr__(self) -> str: response = {"retcode": self.retcode, "message": self.original} args = [repr(response)] if self.msg != self.original: args.append(repr(self.msg)) return f"{type(self).__name__}({', '.join(args)})" @property def response(self) -> typing.Mapping[str, typing.Any]: return {"retcode": self.retcode, "message": self.original, "data": None}
Ancestors
- builtins.Exception
- builtins.BaseException
Subclasses
- genshin.errors.AccountDoesNotExist
- genshin.errors.AccountHasLocked
- genshin.errors.AccountLoginFail
- AccountNotFound
- AlreadyClaimed
- AuthkeyException
- CookieException
- DailyGeetestTriggered
- DataNotPublic
- GeetestError
- genshin.errors.IncorrectGameAccount
- genshin.errors.IncorrectGamePassword
- genshin.errors.InternalDatabaseError
- genshin.errors.OTPRateLimited
- RedemptionException
- genshin.errors.VerificationCodeRateLimited
- genshin.errors.VisitsTooFrequently
- genshin.errors.WrongOTP
Class variables
var msg : str
var original : str
var retcode : int
Instance variables
prop response : Mapping[str, Any]
-
Expand source code
@property def response(self) -> typing.Mapping[str, typing.Any]: return {"retcode": self.retcode, "message": self.original, "data": None}
class InvalidAuthkey (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Authkey is not valid.
Expand source code
class InvalidAuthkey(AuthkeyException): """Authkey is not valid.""" retcode = -100 msg = "Authkey is not valid."
Ancestors
- AuthkeyException
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class InvalidCookies (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Cookies weren't valid.
Expand source code
class InvalidCookies(CookieException): """Cookies weren't valid.""" retcode = -100 msg = "Cookies are not valid."
Ancestors
- CookieException
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class RedemptionClaimed (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Redemption code has been claimed already.
Expand source code
class RedemptionClaimed(RedemptionException): """Redemption code has been claimed already.""" msg = "Redemption code has been claimed already."
Ancestors
- RedemptionException
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class RedemptionCooldown (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Redemption is on cooldown.
Expand source code
class RedemptionCooldown(RedemptionException): """Redemption is on cooldown.""" msg = "Redemption is on cooldown."
Ancestors
- RedemptionException
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class RedemptionException (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Exception caused by redeeming a code.
Expand source code
class RedemptionException(GenshinException): """Exception caused by redeeming a code."""
Ancestors
- GenshinException
- builtins.Exception
- builtins.BaseException
Subclasses
Class variables
var msg : str
var original : str
var retcode : int
class RedemptionInvalid (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Invalid redemption code.
Expand source code
class RedemptionInvalid(RedemptionException): """Invalid redemption code.""" msg = "Invalid redemption code."
Ancestors
- RedemptionException
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int
class TooManyRequests (response: Mapping[str, Any] = {}, msg: Optional[str] = None)
-
Made too many requests and got ratelimited.
Expand source code
class TooManyRequests(CookieException): """Made too many requests and got ratelimited.""" retcode = 10101 msg = "Cannot get data for more than 30 accounts per cookie per day."
Ancestors
- CookieException
- GenshinException
- builtins.Exception
- builtins.BaseException
Class variables
var msg : str
var original : str
var retcode : int