<div align="center">
![](.media/icon-128x128_round.png)
# `steamleaderboards`
Retrieve and parse Steam leaderboards
</div>
## Links
[![PyPI](https://img.shields.io/pypi/v/steamleaderboards)](https://pypi.org/project/steamleaderboards)
## 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:
```console
$ # If you're using pip in a venv on
$ .venv/bin/pip install steamleaderboards --upgrade
```
```console
$ # If you're using poetry
$ poetry add steamleaderboards
```
Then, create a `LeaderboardGroup` for the desired game.
```python
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.
```python
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.
```python
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:
```console
$ # Using pipx
$ pipx install steamleaderboards
```
Then, you can use it to retrieve leaderboards for one or more Steam games via the terminal:
```console
$ 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](https://steamdb.info/).
Raw data
{
"_id": null,
"home_page": "https://github.com/Steffo99/steamleaderboards",
"name": "steamleaderboards",
"maintainer": "Stefano Pigozzi",
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": "me@steffo.eu",
"keywords": "steam, leaderboards, csv, xml, valve",
"author": "Stefano Pigozzi",
"author_email": "me@steffo.eu",
"download_url": "https://files.pythonhosted.org/packages/96/ed/8d79cc2eefd0e45d849375fa64632016cee4ba49789a31e031c3d3d47bf6/steamleaderboards-1.1.1.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n![](.media/icon-128x128_round.png)\n\n# `steamleaderboards`\n\nRetrieve and parse Steam leaderboards\n\n</div>\n\n## Links\n\n[![PyPI](https://img.shields.io/pypi/v/steamleaderboards)](https://pypi.org/project/steamleaderboards)\n\n## History\n\nIt 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.\n\n## Usage\n\n### In code\n\nTo use `steamleaderboards`, first install it via PyPI:\n\n```console\n$ # If you're using pip in a venv on \n$ .venv/bin/pip install steamleaderboards --upgrade\n```\n\n```console\n$ # If you're using poetry \n$ poetry add steamleaderboards\n```\n\nThen, create a `LeaderboardGroup` for the desired game.\n\n```python\nimport steamleaderboards as sl\nlbgroup = sl.LeaderboardGroup(STEAM_APP_ID)\n```\n\nOnce you have created the `LeaderboardGroup`, you can retrieve the desired leaderboards by using the `LeaderboardGroup.get` method. \nYou can specify the name, the display name or the id of the leaderboard to retrieve.\n\n```python\nleaderboard_a = lbgroup.get(name=LEADERBOARD_NAME)\nleaderboard_b = lbgroup.get(lbid=LEADERBOARD_ID)\nleaderboard_c = lbgroup.get(display_name=LEADERBOARD_DISPLAY_NAME)\n```\n\nWhen 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.\n\n```python\nall_scores = leaderboard_a.entries\nmy_score = leaderboard_a.find_entry(MY_STEAMID_1)\nfirst_place_score = leaderboard_a.find_entry(rank=1)\nlast_place_score = leaderboard_a.find_entry(rank=-1)\n```\n\n### In the terminal\n\nTo use `steamleaderboards`, first install it via PyPI:\n\n```console\n$ # Using pipx\n$ pipx install steamleaderboards\n```\n\nThen, you can use it to retrieve leaderboards for one or more Steam games via the terminal:\n\n```console\n$ steamleaderboards --output_dir=\"./data\" 440\n```\n\nThis will download all leaderboards for Team Fortress 2, the game with the app id `440`, to the `./data` directory.\n\nApp ids for games can be found via [SteamDB](https://steamdb.info/).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Retrieve and parse Steam leaderboards",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://github.com/Steffo99/steamleaderboards",
"Repository": "https://github.com/Steffo99/steamleaderboards"
},
"split_keywords": [
"steam",
" leaderboards",
" csv",
" xml",
" valve"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0164cd14be44a4035b8a30a9d56a6655eab33e4349f299092514c2e50de3ffb9",
"md5": "220087d23bfc2d81d0c8f786d5438437",
"sha256": "abac849576ba5a2596efbefbe196406802ee501602634e629c0d0fe5b704db3f"
},
"downloads": -1,
"filename": "steamleaderboards-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "220087d23bfc2d81d0c8f786d5438437",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 5804,
"upload_time": "2024-05-27T14:35:12",
"upload_time_iso_8601": "2024-05-27T14:35:12.797592Z",
"url": "https://files.pythonhosted.org/packages/01/64/cd14be44a4035b8a30a9d56a6655eab33e4349f299092514c2e50de3ffb9/steamleaderboards-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "96ed8d79cc2eefd0e45d849375fa64632016cee4ba49789a31e031c3d3d47bf6",
"md5": "089e35dc31980d8b9eef94459b6dd370",
"sha256": "fb2843bf53be304b0d8824e10ba0ad3521f4cc08001953b0f42cd65e5de72713"
},
"downloads": -1,
"filename": "steamleaderboards-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "089e35dc31980d8b9eef94459b6dd370",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 4851,
"upload_time": "2024-05-27T14:35:14",
"upload_time_iso_8601": "2024-05-27T14:35:14.541808Z",
"url": "https://files.pythonhosted.org/packages/96/ed/8d79cc2eefd0e45d849375fa64632016cee4ba49789a31e031c3d3d47bf6/steamleaderboards-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-27 14:35:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Steffo99",
"github_project": "steamleaderboards",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "steamleaderboards"
}