Module genshin.models.auth.geetest

Geetest-related models

Classes

class BaseMMT (**data: Any)

Base Geetest verification data model.

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 allow self as a field name.

Expand source code
class BaseMMT(pydantic.BaseModel):
    """Base Geetest verification data model."""

    new_captcha: int
    success: int

    @pydantic.model_validator(mode="before")
    def __parse_data(cls, data: dict[str, typing.Any]) -> dict[str, typing.Any]:
        """Parse the data if it was provided in a raw format."""
        if "data" in data:
            # Assume the data is aigis header and parse it
            session_id = data["session_id"]
            data = data["data"]
            if isinstance(data, str):
                data = json.loads(data)

            data["session_id"] = session_id

        return data

Ancestors

  • pydantic.main.BaseModel

Subclasses

Class variables

var model_computed_fields
var model_config
var model_fields
var new_captcha : int
var success : int
class BaseMMTResult (**data: Any)

Base Geetest verification result model.

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 allow self as a field name.

Expand source code
class BaseMMTResult(pydantic.BaseModel):
    """Base Geetest verification result model."""

    def get_data(self) -> dict[str, typing.Any]:
        """Get the base MMT result data.

        This method acts as `dict` but excludes the `session_id` field.
        """
        return self.model_dump(exclude={"session_id"})

Ancestors

  • pydantic.main.BaseModel

Subclasses

Class variables

var model_computed_fields
var model_config
var model_fields

Methods

def get_data(self) ‑> dict[str, typing.Any]

Get the base MMT result data.

This method acts as dict but excludes the session_id field.

class BaseSessionMMTResult (**data: Any)

Base session-based Geetest verification result model.

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 allow self as a field name.

Expand source code
class BaseSessionMMTResult(BaseMMTResult):
    """Base session-based Geetest verification result model."""

    session_id: str

    def to_aigis_header(self) -> str:
        """Convert the result to `x-rpc-aigis` header."""
        return auth_utility.get_aigis_header(self.session_id, self.get_data())

Ancestors

Subclasses

Class variables

var model_computed_fields
var model_config
var model_fields
var session_id : str

Methods

def to_aigis_header(self) ‑> str

Convert the result to x-rpc-aigis header.

Inherited members

class MMT (**data: Any)

Geetest verification data.

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 allow self as a field name.

Expand source code
class MMT(BaseMMT):
    """Geetest verification data."""

    challenge: str
    gt: str

Ancestors

Subclasses

Class variables

var challenge : str
var gt : str
var model_computed_fields
var model_config
var model_fields
class MMTResult (**data: Any)

Geetest verification 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 allow self as a field name.

Expand source code
class MMTResult(BaseMMTResult):
    """Geetest verification result."""

    geetest_challenge: str
    geetest_validate: str
    geetest_seccode: str

Ancestors

Subclasses

Class variables

var geetest_challenge : str
var geetest_seccode : str
var geetest_validate : str
var model_computed_fields
var model_config
var model_fields

Inherited members

class MMTv4 (**data: Any)

Geetest verification data (V4).

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 allow self as a field name.

Expand source code
class MMTv4(BaseMMT):
    """Geetest verification data (V4)."""

    captcha_id: str = pydantic.Field(alias="gt")
    risk_type: str

Ancestors

Subclasses

Class variables

var captcha_id : str
var model_computed_fields
var model_config
var model_fields
var risk_type : str
class MMTv4Result (**data: Any)

Geetest verification result (V4).

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 allow self as a field name.

Expand source code
class MMTv4Result(BaseMMTResult):
    """Geetest verification result (V4)."""

    captcha_id: str
    lot_number: str
    pass_token: str
    gen_time: str
    captcha_output: str

Ancestors

Subclasses

Class variables

var captcha_id : str
var captcha_output : str
var gen_time : str
var lot_number : str
var model_computed_fields
var model_config
var model_fields
var pass_token : str

Inherited members

class RiskyCheckMMT (**data: Any)

MMT returned by the risky check 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 allow self as a field name.

Expand source code
class RiskyCheckMMT(MMT):
    """MMT returned by the risky check endpoint."""

    check_id: str

Ancestors

Class variables

var check_id : str
var model_computed_fields
var model_config
var model_fields
class RiskyCheckMMTResult (**data: Any)

Risky check MMT 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 allow self as a field name.

Expand source code
class RiskyCheckMMTResult(MMTResult):
    """Risky check MMT result."""

    check_id: str

    def to_rpc_risky(self) -> str:
        """Convert the MMT result to a RPC risky header."""
        return auth_utility.generate_risky_header(self.check_id, self.geetest_challenge, self.geetest_validate)

Ancestors

Class variables

var check_id : str
var model_computed_fields
var model_config
var model_fields

Methods

def to_rpc_risky(self) ‑> str

Convert the MMT result to a RPC risky header.

Inherited members

class SessionMMT (**data: Any)

Session-based geetest verification data.

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 allow self as a field name.

Expand source code
class SessionMMT(MMT):
    """Session-based geetest verification data."""

    session_id: str

    def get_mmt(self) -> MMT:
        """Get the base MMT data."""
        return MMT(**self.model_dump(exclude={"session_id"}))

Ancestors

Class variables

var model_computed_fields
var model_config
var model_fields
var session_id : str

Methods

def get_mmt(self) ‑> MMT

Get the base MMT data.

class SessionMMTResult (**data: Any)

Session-based geetest verification 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 allow self as a field name.

Expand source code
class SessionMMTResult(MMTResult, BaseSessionMMTResult):
    """Session-based geetest verification result."""

Ancestors

Class variables

var geetest_challenge : str
var geetest_seccode : str
var geetest_validate : str
var model_computed_fields
var model_config
var model_fields

Inherited members

class SessionMMTv4 (**data: Any)

Session-based geetest verification data (V4).

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 allow self as a field name.

Expand source code
class SessionMMTv4(MMTv4):
    """Session-based geetest verification data (V4)."""

    session_id: str

    def get_mmt(self) -> MMTv4:
        """Get the base MMTv4 data."""
        return MMTv4(**self.model_dump(exclude={"session_id"}))

Ancestors

Class variables

var model_computed_fields
var model_config
var model_fields
var session_id : str

Methods

def get_mmt(self) ‑> MMTv4

Get the base MMTv4 data.

class SessionMMTv4Result (**data: Any)

Session-based geetest verification result (V4).

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 allow self as a field name.

Expand source code
class SessionMMTv4Result(MMTv4Result, BaseSessionMMTResult):
    """Session-based geetest verification result (V4)."""

Ancestors

Class variables

var captcha_id : str
var captcha_output : str
var gen_time : str
var lot_number : str
var model_computed_fields
var model_config
var model_fields
var pass_token : str

Inherited members