Metadata-Version: 2.1
Name: humblebundle.py
Version: 0.2.0
Summary: HumbleBundle.com unofficial web interaction.
Author: ghostapps
Project-URL: Source, https://github.com/markemicek/humblebundle.py
Keywords: python,humblebundle,games,webapi
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# humblebundle.py

Unofficial Python client for [humblebundle.com](https://www.humblebundle.com).
List live bundles, open a bundle to get the games/books/software inside it, and
pull this month's Humble Choice games — without a browser.

```bash
pip install humblebundle.py
```

## Usage

```python
import humblebundle

# Live bundles per category: games, books, software, bundles/all
bundles = humblebundle.get.bundles(['games'])

for bundle in bundles.values():
    print(bundle.title, bundle.price, bundle.end_date)
    print(bundle.included_item_titles[:3])

# Open a bundle and get the items inside it
items = bundles['survivalfittest_bundle'].stepin()
for item in items.values():
    print(item.title, item.msrp, item.developers, item.publishers)
```

```python
import humblebundle

# A single bundle by slug or URL
bundle = humblebundle.get.bundle('survival-fittest')
print(bundle.title, bundle.retail_value, len(bundle.tiers))

# This month's Humble Choice games
choices = humblebundle.get.choices()
for game in choices.values():
    print(game.title, game.developers, game.price, game.end_date)
```

Products are `_Product` objects: every field is available as an attribute, the
untouched source object is kept in `.raw`, and the object is mapping-like too
(`product['title']`, `product.to_dict()`, `dict(product)`).

### Common fields

| Field | Description |
| --- | --- |
| `name` | Machine key of the product |
| `title` | Display title |
| `url` / `product_url` | Absolute product URL (bundles) |
| `price` | Current price, as a float in `currency` |
| `retail_value` | Total value of the contents |
| `items_count` | Number of items in the bundle |
| `included_item_titles` | Titles of the items in the bundle |
| `platforms` / `delivery_methods` | e.g. `windows`, `steam` |
| `start_date` / `end_date` | ISO-8601 timestamps |
| `developers` / `publishers` | Names (bundle items and Choice games) |
| `raw` | The full source object |

## Command line

```bash
python -m humblebundle bundles games
python -m humblebundle bundle survival-fittest
python -m humblebundle items games survival-fittest
python -m humblebundle choices
```

Each command prints JSON.

## How it works

Humble Bundle moved to a Next.js (App Router) front end. Page data is no longer
published in `<script type="application/json">` islands; it is streamed inside
the React Server Components "flight" payload embedded in the HTML.

`humblebundle._rsc` extracts that payload, splits it into rows and resolves the
`"$<row-id>"` / `"$<row-id>:<path>"` references the format uses, so the rest of
the package only deals with plain dictionaries and lists.

## Notes

- Only public page data is read; no login or account access is used.
- The current Humble Choice month is the only one available — Humble removed the
  per-month pages, so `choices()` accepts (and ignores) `month`/`year`.
- humblebundle.com asks automated clients to be respectful; keep request volume
  low and cache results in your own code.
- This project is not affiliated with Humble Bundle.

## License

MIT — see [LICENSE.txt](LICENSE.txt).
