steam

Adapter over vendor-fabric’s Steam connector.

Steam access, adapted from vendor-fabric’s Steam connector.

The connector itself lives in vendor_fabric.steam; this module adapts it to the engine’s SteamGateway protocol and adds session persistence between runs.

class humble_steam_key_redeemer.steam.SteamCredentials(account_name, password, steam_guard_code=None)[source]

Bases: object

Credentials for a Steam sign-in.

Variables:
  • account_name – Steam account name, not the display name.

  • password – Account password.

  • steam_guard_code – Steam Guard code, when already known.

Parameters:
  • account_name (str)

  • password (str)

  • steam_guard_code (str | None)

account_name: str
password: str
steam_guard_code: str | None
class humble_steam_key_redeemer.steam.VendorFabricSteamGateway(settings, connector=None)[source]

Bases: object

Engine-facing wrapper around vendor_fabric.steam.SteamConnector.

Parameters:
  • settings (Settings) – Runtime configuration, used for the session path.

  • connector (SteamConnector | None) – An existing connector, mainly for testing.

property connector: SteamConnector

The underlying vendor-fabric connector.

restore(account_name=None)[source]

Reuse a saved session when one is still valid.

Parameters:

account_name (str | None) – When given, the saved session is only reused if it belongs to this account. Activations are irreversible, so a session for a different account must never be used silently.

Return type:

bool

Returns:

True when an existing session was restored and accepted.

authenticate(credentials)[source]

Sign in to Steam and persist the resulting session.

Parameters:

credentials (SteamCredentials) – The credentials to sign in with.

Return type:

None

list_owned_apps()[source]

Return owned Steam applications, fetched once per run.

Return type:

dict[int, str]

Returns:

Mapping of application id to name.

redeem_key(key)[source]

Redeem one product key.

Parameters:

key (str) – The Steam product key.

Return type:

dict[str, Any]

Returns:

The connector’s result mapping.

close()[source]

Release the connector’s HTTP client.

Return type:

None

humble_steam_key_redeemer.steam.load_session(path)[source]

Load a previously saved Steam session.

A missing, unreadable, or malformed file means “sign in again” rather than an error, so an interrupted write cannot lock the user out of the tool.

Parameters:

path (Path) – Session file path.

Return type:

SteamSession | None

Returns:

The stored session, or None when unavailable.

humble_steam_key_redeemer.steam.save_session(session, path, account_name=None)[source]

Persist a Steam session to disk.

The session tokens are bearer credentials that survive Steam Guard, so the file is written with owner-only permissions.

Parameters:
  • session (SteamSession) – The session to store.

  • path (Path) – Destination path.

  • account_name (str | None) – Account the session belongs to, so a later run can tell whether a saved session matches the account being asked for.

Return type:

Path

Returns:

The path written.

humble_steam_key_redeemer.steam.session_account(path)[source]

Return the account name a saved session belongs to, if recorded.

Parameters:

path (Path) – Session file path.

Return type:

str | None

Returns:

The account name, or None when absent or unreadable.