SteamPI: a simple API for Steam
This repository contains Python code to download some data through Steam API.
Installation
The code is packaged for PyPI, so that the installation consists in running:
pip install steampi
Usage
Download app details of a Steam game, given its appID
import steampi.api
app_id = '440'
(app_details, is_success, status_code) = steampi.api.load_app_details(app_id)
Retrieve the release date of a Steam game, given its appID
import steampi.calendar
app_id = '440'
release_date = steampi.calendar.get_release_date_as_datetime(app_id)
Retrieve the release year of a Steam game, given its appID
import steampi.calendar
app_id = '440'
release_year = steampi.calendar.get_release_year(app_id)
Find the most similar game names to an input text
Using the Levenshtein distance
The Levenshtein distance is an edit distance, which is useful to fix typos for instance.
import steampi.text_distances
import steamspypi
steamspy_database = steamspypi.load()
input_text = 'Crash Bandicoot'
sorted_app_ids, text_distances = steampi.text_distances.find_most_similar_game_names(input_text,
steamspy_database)
num_games_to_print = 5
for i in range(num_games_to_print):
similar_game_name = steamspy_database[sorted_app_ids[i]]
print(similar_game_name)
Using the longest contiguous matching subsequence
The code snippet below makes use of the longest contiguous matching subsequence. This leads to different results compared to Levenshtein distance, which you might find more suitable for your needs.
However:
- the code is slower than with Levenshtein distance: for instance, the run-time is 140% longer for the unit test,
- the text distances are bound to [0,1], so they do not have the same value range as for Levenshtein distance,
- the text distances do not have the same meaning as for Levenshtein distance, which was the minimal number of edits,
- the results do not contain all the text distances, but only these with less than 0.4 distance (i.e. 0.6 similarity).
Junk characters can be specified with junk_str.
import steampi.text_distances
import steamspypi
steamspy_database = steamspypi.load()
num_games_to_print = 5
junk_str=''
input_text = 'Crash Bandicoot'
sorted_app_ids, text_distances = steampi.text_distances.find_most_similar_game_names(input_text,
steamspy_database,
use_levenshtein_distance=False,
n=num_games_to_print,
junk_str=junk_str,
)
for i in range(len(sorted_app_ids)):
similar_game_name = steamspy_database[sorted_app_ids[i]]
print(similar_game_name)
References
- Levenshtein module for the Levenshtein distance,
- Difflib module for the longest contiguous matching subsequence.
Metadata
Release files for steampi 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| steampi-0.5.2.tar.gz | 8.8 kB | Without provenance | Details for steampi-0.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| steampi-0.5.2-py3-none-any.whl | Python 3 | none | any | Details for steampi-0.5.2-py3-none-any.whl |
Total release size: 20.9 kB
Release files / steampi-0.5.2.tar.gz
| Download URL | steampi-0.5.2.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a6a698d3c41bfe253446bef79380df406d754adeb704f214c55a5bcaaac140a
|
|
BLAKE2b-256 checksum How to use checksums |
aaea53634359cc044e0afcdc2f5fd5800a91a0b62bc209581d05d2f65e5c6e44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
|
Release files / steampi-0.5.2-py3-none-any.whl
| Download URL | steampi-0.5.2-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
821651e627569af2dcf0fa9a1dd0d2e37553c83d833c67f66f0a7d061617b07f
|
|
BLAKE2b-256 checksum How to use checksums |
690b11b4b05d12c02e74f3a050c76a61a4c010ad890d433e901355e476dd60ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
|
Security for steampi 0.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.