hd2api package

Subpackages

Submodules

hd2api.api_config module

class hd2api.api_config.APIConfig(*, api_comm: str = 'https://api.helldivers2.dev', api_diveharder: str = 'https://api.diveharder.com', api_direct: str = 'https://api.live.prod.thehelldiversgame.com', use_raw: Literal['community', 'diveharder', 'direct'] = 'direct', verify: bool | str = True, client_name: str = 'DefaultClientName', client_contact: str | None = None, language: str = 'en-US', warID: int = 801, static_path: str = '', timeout: float = 8, statics: StaticAll | None = None)

Bases: BaseModel

Primary configuration object used for the API service functions.

api_comm: str
api_direct: str
api_diveharder: str
client_contact: str | None
client_name: str
get_client_name() str

Get the client name.

language: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

static_path: str
staticdata() StaticAll

If not already present, build up the model of static data.

statics: StaticAll | None
timeout: float
use_raw: Literal['community', 'diveharder', 'direct']
verify: bool | str
warID: int
exception hd2api.api_config.HTTPException(status_code: int, message: str)

Bases: Exception

hd2api.load_json module

hd2api.load_json.get_repo_dir() str

Get the directory path for the default static json file directory.

Returns:

The target directory path.

Return type:

str

hd2api.load_json.load_and_merge_json_files(json_path: str, static_dir: str | None = None)

Load all JSON files from the specified directory into a single dictionary.

Args: - directory_path (str): Path to the directory containing JSON files.

Returns: - dict: A dictionary where keys are file names (without extension) and values are loaded JSON data.

Module contents