Skip to main content

Retrieve and parse Steam leaderboards

Project description

steamleaderboards

Retrieve and parse Steam leaderboards

Links

PyPI

History

It was created with the Isaac Daily Run scoreboards in mind, but it can be used for other games that have a public leaderboard as well.

Usage

In code

To use steamleaderboards, first install it via PyPI:

$ # If you're using pip in a venv on 
$ .venv/bin/pip install steamleaderboards --upgrade
$ # If you're using poetry 
$ poetry add steamleaderboards

Then, create a LeaderboardGroup for the desired game.

import steamleaderboards as sl
lbgroup = sl.LeaderboardGroup(STEAM_APP_ID)

Once you have created the LeaderboardGroup, you can retrieve the desired leaderboards by using the LeaderboardGroup.get method.
You can specify the name, the display name or the id of the leaderboard to retrieve.

leaderboard_a = lbgroup.get(name=LEADERBOARD_NAME)
leaderboard_b = lbgroup.get(lbid=LEADERBOARD_ID)
leaderboard_c = lbgroup.get(display_name=LEADERBOARD_DISPLAY_NAME)

When you have the Leaderboard object, you can find all the entries in the Leaderboard.entries field, or you can search for a specific one through the Leaderboard.find_entry method.

all_scores = leaderboard_a.entries
my_score = leaderboard_a.find_entry(MY_STEAMID_1)
first_place_score = leaderboard_a.find_entry(rank=1)
last_place_score = leaderboard_a.find_entry(rank=-1)

In the terminal

To use steamleaderboards, first install it via PyPI:

$ # Using pipx
$ pipx install steamleaderboards

Then, you can use it to retrieve leaderboards for one or more Steam games via the terminal:

$ steamleaderboards --output_dir="./data" 440

This will download all leaderboards for Team Fortress 2, the game with the app id 440, to the ./data directory.

App ids for games can be found via SteamDB.

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

steamleaderboards-1.1.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

steamleaderboards-1.1.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file steamleaderboards-1.1.2.tar.gz.

File metadata

  • Download URL: steamleaderboards-1.1.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.9.1-zen1-1-zen

File hashes

Hashes for steamleaderboards-1.1.2.tar.gz
Algorithm Hash digest
SHA256 0732e4a2c62b02ccf697d21ed3ab89bd000424e80f5e48b7483a488a04637dd6
MD5 97e1c3bac145f3ab1bd8eed4b93ef42b
BLAKE2b-256 78b399975653814c80214531d9e3d0372d6e2ec105e1a6dfc2f831a3946d0d90

See more details on using hashes here.

File details

Details for the file steamleaderboards-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: steamleaderboards-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.9.1-zen1-1-zen

File hashes

Hashes for steamleaderboards-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c4d0e45ceddd1593e6af7ec3b7e9fbb0efdcb6b9615b0771feea44b2bed0c69f
MD5 32a4d8028d7c3082a71d09f07277669a
BLAKE2b-256 d7c61262437792549f548521f9c5f869e7edb0765e774e9d47af8342b44c78f4

See more details on using hashes here.

Supported by

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