Skip to content
cbyte edited this page Jul 23, 2026 · 4 revisions

steam

steam is a Python client for the Steam network — CM protocol, PICS / CDN, WebAuth, Web API, Steam Guard, SteamIDs, master-server queries.

This is a maintained fork of ValvePython/steam, living at H47R15/steam. Upstream is largely inactive; this fork exists to keep the library working against modern Python and current Steam wire protocols. See Fork Changes for a detailed diff of what's different.

Highlights

  • Python 3.13+ only. Legacy py2 / py<3.4 compat shims removed.
  • Modern protobuf 5.26+ / 6.x runtime, freshly regenerated _pb2 files from current .proto sources.
  • Full .pyi type stubs for every generated protobuf module — msg.field accesses type-check under Pylance / pyright.
  • Poetry-first workflow. Regeneration steps registered as poetry run pb-* console scripts.
  • Bug fixes latent in upstream, surfaced while porting (see the README for details).

Quick start

Install:

git clone https://github.com/H47R15/steam.git
cd steam
poetry install --with dev --extras client

The shortest complete script — anonymous PICS lookup for Helldivers 2 (553850):

from steam.client import SteamClient

client = SteamClient()
assert client.anonymous_login()
resp = client.get_product_info(apps=[553850], timeout=15)
print(resp['apps'][553850]['common']['name'])
client.logout()
client.disconnect()

Walk through this snippet line by line on the First script page.

Features

  • SteamClient — CM protocol client on top of gevent. Login flows (password / refresh-token / anonymous), PICS product info, friends list, chat, game-coordinator hooks.
    • PICS — the batched app / package metadata catalogue, reached through SteamClient.get_product_info. Includes a comparison of PICS vs. store HTTP vs. Web API for picking the right surface.
  • AsyncSteamClient (new in 1.6)asyncio facade around SteamClient for FastAPI / TaskIQ / any asyncio app. Runs the sync client on a dedicated daemon thread with its own gevent hub — the asyncio process is never monkey-patched. Auto-reconnect, typed exceptions, event bridge, cancellation, status/metrics hooks.
    • Pool — multi-account variant for concurrent connections.
    • FastAPI Integrationlifespan + Depends helpers.
    • TaskIQ Integration — broker startup hook + TaskiqDepends provider.
    • MCP — expose the client as Model-Context-Protocol tools an LLM agent can call. FastMCP adapter included.
  • CDNClient — content-depot downloads with manifest parsing.
  • WebAuth / MobileWebAuth — obtain authenticated requests.Session cookies for store.steampowered.com / steamcommunity.com.
  • WebAPI — thin wrapper around Steam's api.steampowered.com with dynamic interface discovery.
  • SteamAuthenticator — enable / disable / verify Steam Guard 2FA.
  • SteamID — parse and convert between 32-bit / 64-bit / STEAM_X:Y:Z / community-URL representations.
  • Master Server Queries — query masters directly or through SteamClient.

Getting started

  1. Installation — Poetry setup, client extra, protoc.
  2. First script — walk through the anonymous PICS example and a WebAPI-only variant.
  3. Pick a topic from the sidebar. Every feature has its own page.

Regenerating the wire format

Steam changes protobufs periodically. When they do:

poetry run pb-update

That runs fetch → compile → services → gen-enums in sequence. Fine-grained control and troubleshooting live on the Regenerating Protobufs page.

Testing

poetry run pytest             # ~83 tests, ~1s, no internet required
poetry run pytest -k webapi   # filter subset

Web-facing tests replay VCR cassettes from vcr/*.yaml — see Contributing for the regeneration recipe when Steam responses drift.

Where to go next

  • Never touched a Steam client library before? Read First script, then SteamClient.
  • Building a FastAPI / TaskIQ / MCP service? Jump to AsyncSteamClient, then the framework page you need — FastAPI, TaskIQ, or MCP.
  • Running multiple Steam accounts in one process? Pool.
  • Downloading depot files? Jump straight to CDNClient.
  • Just need to hit api.steampowered.com? WebAPI is standalone — no gevent, no client extra needed.
  • Building anything that hits Steam's login flow? WebAuth and SteamAuthenticator cover the mobile-2FA path.
  • Contributing back or resyncing with upstream? Contributing and Fork Changes have the process.
  • Still confused? The FAQ answers the top questions we get.

Clone this wiki locally