Module genshin.models.auth.cookie
Cookie-related models
Classes
-
App login cookies.
Returned by
client.login_with_app_password
.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class AppLoginResult(CookieLoginResult): """App login cookies. Returned by `client.login_with_app_password`. """ stoken: str ltuid_v2: str ltmid_v2: str account_id_v2: str account_mid_v2: str
Ancestors
- CookieLoginResult
- pydantic.main.BaseModel
Class variables
Inherited members
-
Web login cookies.
Returned by
client.cn_login_with_password
.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class CNWebLoginResult(CookieLoginResult): """Web login cookies. Returned by `client.cn_login_with_password`. """ cookie_token_v2: str account_mid_v2: str account_id_v2: str ltoken_v2: str ltmid_v2: str ltuid_v2: str
Ancestors
- CookieLoginResult
- pydantic.main.BaseModel
Class variables
Inherited members
-
Base model for cookie login result.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class CookieLoginResult(pydantic.BaseModel): """Base model for cookie login result.""" def to_str(self) -> str: """Convert the login cookies to a string.""" return "; ".join(f"{key}={value}" for key, value in self.model_dump().items()) def to_dict(self) -> dict[str, str]: """Convert the login cookies to a dictionary.""" return self.model_dump()
Ancestors
- pydantic.main.BaseModel
Subclasses
Class variables
Methods
-
Convert the login cookies to a dictionary.
-
Convert the login cookies to a string.
-
Cookies returned by the device grant endpoint.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class DeviceGrantResult(pydantic.BaseModel): """Cookies returned by the device grant endpoint.""" game_token: str login_ticket: typing.Optional[str] = None @pydantic.model_validator(mode="before") def _str_to_none(cls, data: dict[str, typing.Union[str, None]]) -> dict[str, typing.Union[str, None]]: """Convert empty strings to `None`.""" for key in data: if data[key] == "" or data[key] == "None": data[key] = None return data
Ancestors
- pydantic.main.BaseModel
Class variables
-
Game login result.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class GameLoginResult(pydantic.BaseModel): """Game login result.""" combo_id: str open_id: str combo_token: str heartbeat: bool account_type: int
Ancestors
- pydantic.main.BaseModel
Class variables
-
Mobile number login cookies.
Returned by
client.login_with_mobile_number
.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class MobileLoginResult(CookieLoginResult): """Mobile number login cookies. Returned by `client.login_with_mobile_number`. """ cookie_token_v2: str account_mid_v2: str account_id_v2: str ltoken_v2: str ltmid_v2: str
Ancestors
- CookieLoginResult
- pydantic.main.BaseModel
Class variables
Inherited members
-
QR code login cookies.
Returned by
client.login_with_qrcode
.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class QRLoginResult(CookieLoginResult): """QR code login cookies. Returned by `client.login_with_qrcode`. """ cookie_token_v2: str account_mid_v2: str account_id_v2: str ltoken_v2: str ltmid_v2: str ltuid_v2: str
Ancestors
- CookieLoginResult
- pydantic.main.BaseModel
Class variables
Inherited members
-
Result of fetching
stoken
withfetch_stoken_by_game_token
.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class StokenResult(pydantic.BaseModel): """Result of fetching `stoken` with `fetch_stoken_by_game_token`.""" aid: str mid: str token: str @pydantic.model_validator(mode="before") def _transform_result(cls, values: dict[str, typing.Any]) -> dict[str, typing.Any]: return { "aid": values["user_info"]["aid"], "mid": values["user_info"]["mid"], "token": values["token"]["token"], }
Ancestors
- pydantic.main.BaseModel
Class variables
-
Web login cookies.
Returned by
client.login_with_password
.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class WebLoginResult(CookieLoginResult): """Web login cookies. Returned by `client.login_with_password`. """ cookie_token_v2: str account_mid_v2: str account_id_v2: str ltoken_v2: str ltmid_v2: str ltuid_v2: str
Ancestors
- CookieLoginResult
- pydantic.main.BaseModel
Class variables
Inherited members