splatnet3_scraper.auth.NSO(session)

Initializes the NSO class. The NSO class contains all the logic and holds all the necessary values to proceed through the login flow.

The __init__ method sets the following internal variables:

  • session: The requests session object that is used to make requests to the Nintendo Switch Online API. This is the only variable that is passed in to the __init__ method.

  • _state: The internal state variable that is used to obtain the session token. This is a random string that is generated when the NSO.state property is first accessed, and is used to generate the login URL.

  • _verifier: The internal verifier variable that is used to obtain the session token. This is a random string that is generated when the NSO.verifier property is first accessed, and is used to generate the login URL. The verifier is also used to solve the code challenge, verifying to Nintendo that the user is who they say they are.

  • _version: The internal version variable that is used to verify the NSO app version. This is a string that is generated when the NSO.version property is first accessed, and is used to obtain the session token.

  • _web_view_version: The internal web view version variable that is used to verify the NSO app version. This is a string that is generated when the NSO.web_view_version property is first accessed, and is used to obtain the session token.

  • _session_token: A stored session token. This is required to generate all other tokens and information. This is obtained during the login flow and is valid for 2 years.

  • _user_access_token: A stored user access token. This is a token that is obtained during the login flow and is used to obtain the user information.

  • _id_token: A stored id token. This is a token that is obtained during the login flow and is used to obtain the gtoken.

  • _gtoken: A stored gtoken. This is a token that is obtained during the login flow and is used to obtain the bullet token. It is valid for 6 hours and 30 minutes.

  • _user_info: A stored user information dictionary. This is obtained during the login flow and is used to obtain the “f” token.

  • _f_token_function: A stored function that is used to obtain the “f” token. This function is set to the get_ftoken method by default, and can be set with the set_new_f_token_function method to use a user-defined function if desired.

Parameters:
session : requests.Session

The NSO class uses a requests session to make requests to the Nintendo Switch Online API. The session object is passed in to the NSO class so that the same session object can be used to make requests to the SplatNet API.