humble¶
Humble Bundle access through a real browser.
Humble Bundle access.
Humble publishes no API for library or key access, so this half of the tool drives a real browser and issues Humble’s own XHR calls from inside the authenticated page.
Example:
from humble_steam_key_redeemer.humble import HumbleBrowser, HumbleClient
with HumbleBrowser(settings) as browser:
client = HumbleClient(browser)
if client.is_logged_in():
orders = client.order_details()
- exception humble_steam_key_redeemer.humble.HumbleAPIError[source]¶
Bases:
RuntimeErrorRaised when Humble rejects a request or returns an unusable response.
- class humble_steam_key_redeemer.humble.HumbleBrowser(settings)[source]¶
Bases:
objectA Playwright browser session scoped to Humble Bundle.
- Parameters:
settings (
Settings) – Runtime configuration.
- start()[source]¶
Start the browser session, restoring a saved session when present.
When
cdp_endpointis configured, attaches to that already-running browser instead of launching a new one. That lets the tool reuse a browser a person is already signed into — including one an agent is driving — rather than requiring a separate sign-in in an isolated profile.- Return type:
Self- Returns:
This browser session.
- Raises:
HumbleBrowserError – If the browser cannot be started or reached.
- save_session()[source]¶
Persist the browser session for reuse.
Only Humble’s own cookies are kept. Attaching to an everyday browser means the context holds bearer credentials for every site signed in there, and writing those to disk — then loading them into a browser this tool launches — would spread them well beyond what redeeming keys needs.
Session cookies are bearer credentials, so the file is written with owner-only permissions.
- Return type:
- Returns:
The path written.
- property page: Page¶
The active page.
- exception humble_steam_key_redeemer.humble.HumbleBrowserError[source]¶
Bases:
RuntimeErrorRaised when the browser cannot be started or driven.
- class humble_steam_key_redeemer.humble.HumbleClient(browser, timeout_ms=30000)[source]¶
Bases:
objectReads orders and reveals keys through an authenticated browser session.
- Parameters:
browser (
HumbleBrowser) – A startedHumbleBrowser.timeout_ms (int)
- is_logged_in()[source]¶
Report whether the session is signed in to Humble.
- Return type:
- Returns:
Truewhen the library page loads without redirecting.
- is_logged_in_quietly()[source]¶
Report whether the session is signed in, without navigating.
Polling
is_logged_in()while someone is signing in destroys the form they are typing into, because it navigates. This asks the same question with a request instead, so a login page or a two-factor prompt is left alone.- Return type:
- Returns:
Truewhen Humble serves the library without redirecting.
- order_keys()[source]¶
List the gamekeys of every order on the account.
- Return type:
- Returns:
Humble order identifiers.
- Raises:
HumbleAPIError – If the order list cannot be read.
- reveal_key(record)[source]¶
Reveal a key on Humble so Steam can redeem it.
Revealing is irreversible: it forfeits the ability to generate a gift link for that entry, which is why callers must confirm first.
- Parameters:
record (
KeyRecord) – The key to reveal.- Return type:
- Returns:
The revealed key value, or
Noneif Humble declined.- Raises:
HumbleAPIError – If Humble reports an error.