Giter Site home page Giter Site logo

steamspypi's Introduction

SteamSpyPI: an API for SteamSpy

PyPI status Build status Code coverage Code Quality

This repository contains Python code to download data through SteamSpy API.

Installation

The code is packaged for PyPI, so that the installation consists in running:

pip install steamspypi

Usage

Returns details for 1000 games. Data is sorted by decreasing number of owners.

A page parameter is now required for all requests, starting at page=0. You will be able to retrieve 1000 games per all request.

Moreover, the API rate is now heavily limited for all requests. You will be able to issue 1 all request per minute.

import steamspypi

data_request = dict()
data_request['request'] = 'all'
data_request['page'] = '0'

data = steamspypi.download(data_request)

Returns details for 1000 games. This time, data is cached locally for offline reuse.

In this case, page is forcibly set to 0, without any access to this parameter for the end-user.

Local cache is in data/%Y%m%d_steamspy.json, without mentioning page in the file name for backward compatibility.

import steamspypi

data = steamspypi.load()

Returns details for all of the games.

Please refer to this for-loop to accomodate recent API rate-limits.

Alternatively, if you know the exact number of pages, e.g. 44 as of March 29, 2021:

import steamspypi

data = steamspypi.download_all_pages(num_pages=44)

Returns details for a given application.

import steamspypi

data_request = dict()
data_request['request'] = 'appdetails'
data_request['appid'] = '730'

data = steamspypi.download(data_request)

Returns all games in a given genre.

import steamspypi

data_request = dict()
data_request['request'] = 'genre'
data_request['genre'] = 'Early Access'

data = steamspypi.download(data_request)

Returns all games with a given tag.

import steamspypi

data_request = dict()
data_request['request'] = 'tag'
data_request['tag'] = 'Early Access'

data = steamspypi.download(data_request)

Returns Top 100 games, with respect to the number of players in the last two weeks.

import steamspypi

data_request = dict()
data_request['request'] = 'top100in2weeks'

data = steamspypi.download(data_request)

Returns Top 100 games, with respect to the number of players since March 2009.

import steamspypi

data_request = dict()
data_request['request'] = 'top100forever'

data = steamspypi.download(data_request)

Returns Top 100 games, with respect to the estimated number of owners.

import steamspypi

data_request = dict()
data_request['request'] = 'top100owned'

data = steamspypi.download(data_request)

References

steamspypi's People

Contributors

pyup-bot avatar renovate[bot] avatar woctezuma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

steamspypi's Issues

Dependency Dashboard

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

This repository currently has no open or pending branches.

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
  • requests ==2.31.0

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

SteamSpy has changed its API

At the top of the documentation page of SteamSpy, changes of the API are mentioned.

The biggest change here is the rate limit for the all requests: 1 request per minute.

  *IMPORTANT:* some things have changed, please, read this document through!

  The data is refreshed once a day, there is no reason to request the same information more than once every 24 hours.

  Allowed poll rate - 1 request per second for most requests, 1 request per 60 seconds for the *all* requests.

Moreover, the example mentions a page parameter:

  ## Examples: ##
  * steamspy.com/api.php?request=all&page=1 - return apps 1,000-1,999 of all apps.

which is confirmed later on:

  ### all ###

  Returns all games with owners data sorted by owners. Returns 1,000 entries per page.
  * page - page number for the list (starts at 0)

References:

Creating loop for request = 'all'

Hi woctezuma,
I hope you are well. I had a list of all games crawled using steamspypi in Dec 2019 and now I need to update my list, but I noticed there that there has been an update and request 'all' does not work without specifying page + the 60 sec wait time!

Since my knowledge of Python is limited and it's worst when it comes to loops. Could you please give me some guidance on how to make a loop for the page numbers to collect data for all the games?

I simply do not know how to make a loop in there to collect all game data.

Question about usage.

Would you be willing to possibly speak over email about the usage of this code? Thanks.

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.