Skip to main content

A Python 3 implementation of the REST API

Project description

srcomapi (SpeedrunComAPI) travis-ci

A Python 3 implementation of the REST API. pip3 install srcomapi

Does not support Python 2. Sorry.



>>> import srcomapi, srcomapi.datatypes as dt
>>> api = srcomapi.SpeedrunCom(); api.debug = 1

Searching for a game

# It's recommended to cache the game ID and use it for future requests.
# Data is cached for the current session by classname/id so future
# requests for the same game are instantaneous.
>>>, {"name": "super mario sunshine"})
[<Game "Super Mario Sunshine">]
>>> game = _[0]

Getting the current world record for a game category

>>> game.categories
[<Category "Any%">, ...]
>>> _[0].records[0].runs
[{'run': <Run <Game "Super Mario Sunshine">/<Category "Any%">/9mr570dy 4498>, 'place': 1}, ...]
>>> _[0]["run"].times
{'primary_t': 4498, ...}
# primary_t is the time in seconds

Getting a dict containing all runs from a game

sms_runs = {}
for category in game.categories:
  if not in sms_runs:
    sms_runs[] = {}
  if category.type == 'per-level':
    for level in game.levels:
      sms_runs[][] = dt.Leaderboard(api, data=api.get("leaderboards/{}/level/{}/{}?embed=variables".format(,,
    sms_runs[] = dt.Leaderboard(api, data=api.get("leaderboards/{}/category/{}?embed=variables".format(,

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

srcomapi-0.3.3.tar.gz (6.2 kB view hashes)

Uploaded source

Built Distribution

srcomapi-0.3.3-py3-none-any.whl (6.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page