splatnet3_scraper.query.QueryHandler.query_hash(query_hash, language=None, variables={})

Given a query hash, it will query SplatNet 3 and return the response.

A convenience function that will use a GraphQL query hash rather than a query name to query SplatNet 3. This method will automatically retry once if the query fails and will regenerate the tokens if the query fails for whatever reason. Some queries require variables to be passed in, and this method will allow the user to pass in those variables. It is not recommended to use this method unless the user knows what they are doing, as the query hashes are not stable and can and do change often and without warning. The user should use the query method instead as it will compensate for any changes to the query hashes.

Parameters:
query_hash : str

The query hash to use. This hash must be valid, and must be a string representation rather than a byte representation.

language : str | None

The language to use for the query. If None, the language loaded into the Config object will be used. Defaults to None.

variables : dict

The variables to use in the query. Some queries do not require variables and so this argument can be omitted. If the query does require variables and this argument is omitted, then the query will fail and a SplatNetException will be raised with the error message from SplatNet 3. Defaults to {}.

Raises:

SplatNetException – If the query is successful but returns a JSON object with an errors key, then this exception will be raised with the error message from SplatNet 3. This generally means that the query was successfully generated and the current tokens are still valid, but the query itself failed for some reason. This can happen if the user did not provide the correct required variables for the query, or if the variables provided were somehow invalid.

Returns:

QueryResponse – The response from the query. This object will contain the data from the query, and will also contain the query hash that was used to generate the query. This is useful for debugging purposes.