Skip to main content

Steam Web API

buildstatus

This script will connect to the Steam API to retrieve information about users/games/groups.

How to use

Install

To install, git clone the repository or download the archive from GitHub. Then, run python setup.py install to have the package installed. You can also get the latest release by using pip install steamwebapi.

Use

Currently, to use steamwebapi you must supply a Steam API key. There are two ways to do that currently. First, you can set an environment variable called STEAM_API_KEY to your specific key value and the steamwebapi will use that. Otherwise, when instantiating an steam interface object you can pass steam_api_key in with the API key as its value. For example:

steamuserinfo = ISteamUser(steam_api_key='YOURAPIKEY')

The following example will assume that JSON data is being returned, and you want access to the data as returned by Valve.

from steamwebapi.api import ISteamUser, IPlayerService, ISteamUserStats
steamuserinfo = ISteamUser()
steamid = steamuserinfo.resolve_vanity_url("profileURL")['response']['steamid']
usersummary = steamuserinfo.get_player_summaries(steamid)['response']['players'][0]

The Steam Web API has multiple inferfaces (e.g., ISteamUser, IPlayerService) that provide different functions. After instantiating one of the interfaces the functions can be called with the appropriate paramenters. Each function returns a string of either json, xml, or vdf (valve data format). This can be set by the DEFAULTFORMAT variable or changed in the paramters of the function: steamuserinfo.resolve_vanity_url("profileURL", format="xml").

Alternatively, there is a helper function available to build a “user profile”. At the moment, to use the profile module the STEAM_API_KEY environment variable must be set.

from steamwebapi import profiles
user_profile = profiles.get_user_profile("VanityURLOrSteamID")

print(vars(user_profile))

Steam Web API Documentation

REQUIREMENTS

  • Python
    • 3.5.*

    • 3.4.*

    • 3.3.*

    • 3.2.*

    • 2.7.*

    • 2.6.*

Change Log

September 10, 2022 - v0.1.4

Some PRs to fix bugs

November 2, 2016 - v0.1.3

Bugs

  • Fixed passing API key when instantiating (#1)

December 29, 2015 - v0.1.2

Mostly bug fixes as described below.

Changes

  • Switched to reST instead of markdown to work with pypi

Bugs

  • Fixed issue with profile generation where there was no attribute ‘games’ if there was no game history

  • Prevent an ‘invalid’ primaryclanid being set which is returned on some accounts. For example ID 103582791429521408 is returned, which is 0x170000000000000 in hex. The lower 32 bits are used for the actual group/clan id and in this case they are ‘0’.

  • Not all responses for recently played games return attributes for ‘name’ or image paths. This seems to mostly be limited time betas.

November 27, 2015 - v0.1.1

  • API key must be set via the environment variable STEAM_API_KEY

  • When json format is requested, it is now automatically parsed

July 05, 2013 - v0.1.0

  • Initial script creation.

Metadata

Release files for steamwebapi 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for steamwebapi 0.1.4
File Size Uploaded
steamwebapi-0.1.4.tar.gz 23.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for steamwebapi 0.1.4
File Interpreter ABI Platform
steamwebapi-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 49.7 kB

Release files / steamwebapi-0.1.4.tar.gz

Download URL steamwebapi-0.1.4.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
41784c6666654c87f92afc0143d6f660c8dca5da4335e24c4ce7f0d93780effd
BLAKE2b-256 checksum
How to use checksums
9ed78d3682a74928299ab978deaf5e2a3f91715d772645c550d523fc6fe71009
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15

Release files / steamwebapi-0.1.4-py3-none-any.whl

Download URL steamwebapi-0.1.4-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fecedcb3a225210a407d0dd721b971d0eeba06b30607f5811a1d68ecc353583
BLAKE2b-256 checksum
How to use checksums
d0050ee906fba29a8c924a3ba242ba7280e5b7d498459385edf53698504b4abe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page