Skip to main content

Typed Python client for Steam Store and Web API

Project description

steam-fetcher

PyPI - Version PyPI - Python Version CI License

Typed Python client for the Steam Store API, Steam Web API, and SteamSpy API.

Features

  • Sync & async clients with identical API
  • Pydantic v2 models for all responses
  • Rate limiting — sync (threading) and async (aiolimiter)
  • Retry logic with exponential backoff (only on 5xx errors)
  • Exporters — JSON, CSV, Parquet, SQL
  • CLI via typer
  • API key safety via SecretStr

Installation

pip install steam-fetcher

Optional extras:

pip install steam-fetcher[async]     # async client
pip install steam-fetcher[parquet]   # Parquet export (polars)
pip install steam-fetcher[sql]       # SQL export (SQLAlchemy)
pip install steam-fetcher[cli]       # CLI (typer)
pip install steam-fetcher[all]       # everything

Quick start

Public API (no key required)

from steam_fetcher import SteamClient

with SteamClient() as client:
    game = client.get_game(730)
    print(game.name)  # Counter-Strike 2

    players = client.get_player_count(730)
    print(players.player_count)  # 684339

    results = client.search("half-life")
    for entry in results.entries:
        print(f"{entry.name}{entry.price}")

    reviews = client.get_reviews(730, num_per_page=5)
    print(f"{reviews.score_description}: {reviews.positive}/{reviews.total}")

    news = client.get_news(730, count=3)
    for item in news.items:
        print(item.title)

Async

import asyncio
from steam_fetcher import AsyncSteamClient

async def main():
    async with AsyncSteamClient() as client:
        games = await asyncio.gather(
            client.get_game(730),
            client.get_game(570),
            client.get_game(440),
        )
        for g in games:
            if g:
                print(g.name)

asyncio.run(main())

Authenticated API (requires Steam Web API key)

from steam_fetcher import SteamAuthClient

with SteamAuthClient(api_key="YOUR_KEY") as client:
    profile = client.get_user_profile("76561198000000000")
    print(profile.username)

    library = client.get_user_library("76561198000000000")
    print(f"{library.game_count} games")

    friends = client.get_user_friends("76561198000000000")
    bans = client.get_user_bans(["76561198000000000"])
    badges = client.get_user_badges("76561198000000000")
    level = client.get_steam_level("76561198000000000")
    steam_id = client.resolve_vanity_url("gabelogannewell")

    schema = client.get_game_schema(730)
    app_list = client.get_app_list(max_results=100)

Export

from steam_fetcher.exporters import JsonExporter, CsvExporter

JsonExporter().export([game], "game.json")
CsvExporter().export([game], "game.csv")

CLI

pip install steam-fetcher[cli]

steam-fetcher games details 730
steam-fetcher games search "portal" --format csv --output results.csv
steam-fetcher games players 730
steam-fetcher games news 730 --count 5
steam-fetcher users profile 76561198000000000 --api-key YOUR_KEY
steam-fetcher users friends 76561198000000000 --api-key YOUR_KEY

Available methods

Public (SteamClient / AsyncSteamClient)

Method Returns
get_game(app_id, country, language) GameDetails
get_player_count(app_id) PlayerCount
get_reviews(app_id, language, review_filter, num_per_page, cursor) ReviewSummary
search(query, country, language) SearchResult
get_steamspy_details(app_id) SteamSpyDetails
get_news(app_id, count, max_length) AppNews
get_global_achievement_percentages(app_id) GlobalAchievements

Authenticated (SteamAuthClient / AsyncSteamAuthClient)

All public methods plus:

Method Returns
get_user_profile(steam_id) UserProfile
get_user_profiles(steam_ids) list[UserProfile]
get_user_library(steam_id) UserLibrary
get_user_achievements(steam_id, app_id) GameAchievements
get_user_friends(steam_id) FriendList
get_user_bans(steam_ids) list[PlayerBan]
resolve_vanity_url(vanity_url) str
get_recently_played(steam_id) RecentlyPlayed
get_steam_level(steam_id) int
get_user_badges(steam_id) UserBadges
get_wishlist(steam_id) list[WishlistItem]
get_user_stats(steam_id, app_id) UserStats
get_game_schema(app_id) GameSchema
get_app_list(last_appid, max_results) AppList

Documentation

Full docs: cop1cat.github.io/steam-fetcher (English + Русский)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

steam_fetcher-0.1.0.tar.gz (133.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

steam_fetcher-0.1.0-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file steam_fetcher-0.1.0.tar.gz.

File metadata

  • Download URL: steam_fetcher-0.1.0.tar.gz
  • Upload date:
  • Size: 133.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for steam_fetcher-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fc5a4a5e2a2d11169f579325a47fec1dbb5305654a89f4fac958cc8b985b149c
MD5 8daca803f1a23c991e2b6b6798e8b948
BLAKE2b-256 13d4aee30835a86d675e9db71399bf678cdf79e8e863c51760253a87fa5bcdaa

See more details on using hashes here.

File details

Details for the file steam_fetcher-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: steam_fetcher-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for steam_fetcher-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb9a54e009991b3bc9c8c13403ec2b026e98475680665b3a66a25f319d9a2d76
MD5 edc126a95f231b5f3c51ef7587832cb0
BLAKE2b-256 e657322778fc34a4210168944916de3d6c8249b37168e380ca3791371584aee5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page