Git Product home page Git Product logo

steampi's Introduction

SteamPI: a simple API for Steam

PyPI status Build status Code coverage Code Quality

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

steampi's People

Contributors

dependabot[bot] avatar pyup-bot avatar renovate[bot] avatar woctezuma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

coldblackice

steampi's Issues

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/python-package.yml
  • actions/checkout v4
  • actions/setup-python v5
  • codecov/codecov-action v4
.github/workflows/python-publish.yml
  • actions/checkout v4
  • actions/setup-python v5
pip_requirements
requirements.txt
  • python-Levenshtein ==0.25.0
  • requests ==2.31.0
  • steamspypi ==1.1.1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.