splitsio
A Python implementation of the splits.io REST API.
splitsio currently supports read-only access. To upload runs, use the REST API directly.
Requires Python 3.7 or greater.
To install: pip3 install splitsio
Then to access the main data types in Python:
from splitsio import *
Usage
Game
Get information about a game
>>> sms = Game.from_id('sms')
>>> sms
Game(id='15', name='Super Mario Sunshine', shortname='sms')
>>> sms.created_at
'2014-04-18T06:28:59.764Z'
NOTE: for games, the identifier for querying is the shortname (here 'sms'), not the numerical id.
Get all games in the database
>>> games = Game.all() # this can take a minute or so
>>> len(games)
17237
>>> games[0]
Game(id='2206', name='007: Agent Under Fire', shortname='auf')
Search games by name/keyword
>>> mario_games = Game.search('mario')
>>> len(mario_games)
353
>>> mario_games[0]
Game(id='2524', name='Super Mario Advance 4: Super Mario Bros. 3', shortname='sma4')
Category
Get the speedrun categories for a game
>>> oot = Game.from_id('oot')
>>> oot.categories[0]
Category(id='86832', name='No ACE')
Get category from id
>>> no_ace = Category.from_id('86832')
>>> no_ace
Category(id='86832', name='No ACE')
Runner
Get runners for a game or category
>>> oot_runners = Game.from_id('oot').runners()
>>> len(oot_runners)
238
>>> oot_runners[0]
Runner(id='35', twitch_id='31809791', twitch_name='cma2819', display_name='cma2819', name='cma2819')
>>> no_ace_runners = Category.from_id('86832').runners()
>>> no_ace_runners[0]
Runner(id='32189', twitch_id='63370787', twitch_name='bigmikey_', display_name='bigmikey_', name='bigmikey_')
Get runner from id
>>> bigmikey = Runner.from_id('bigmikey_')
>>> bigmikey
Runner(id='32189', twitch_id='63370787', twitch_name='bigmikey_', display_name='bigmikey_', name='bigmikey_')
NOTE: for runners, the identifier for querying is the name all lowercased (here 'bigmikey_'), not the numerical id.
Run
Get runs for a game, category, or runner
>>> oot_runs = Game.from_id('oot').runs()
>>> run = oot_runs[0]
>>> run.realtime_duration_ms
1507300
>>> run.program
'livesplit'
>>> run.attempts
97
>>> len(Category.from_id('86832').runs())
11
>>> len(Runner.from_id('bigmikey_').runs())
2
Get attempt histories for a run and its segments
>>> run = Game.from_id('oot').runs()[0]
>>> run = Run.from_id(run.id, historic = True)
>>> len(run.histories)
90
>>> run.histories[1]
History(attempt_number=89, realtime_duration_ms=1507300, gametime_duration_ms=None, started_at='2020-03-10T20:06:08.000Z', ended_at='2020-03-10T20:31:15.000Z')
>>> run.segments[0].name
'Sword Get'
>>> len(run.segments[0].histories)
67
>>> run.segments[0].histories[0]
History(attempt_number=2, realtime_duration_ms=271832, gametime_duration_ms=0, started_at=None, ended_at=None)
Metadata
Release files for splitsio 0.1.0
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 | |
|---|---|---|---|---|
| splitsio-0.1.0.tar.gz | 21.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| splitsio-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.9 kB
Release files / splitsio-0.1.0.tar.gz
| Download URL | splitsio-0.1.0.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac1bae52c6f233dd6f52ec85e63c32d5e0f80272581095967aaf76ef0d681aaa
|
|
BLAKE2b-256 checksum How to use checksums |
91c4b0aadd9ced8d22c0ab4739fdba6932d7bbdf0af58da1d5c7cdc35922fde2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.3 CPython/3.7.4 Darwin/17.7.0
|
Release files / splitsio-0.1.0-py3-none-any.whl
| Download URL | splitsio-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52dd52b7d4443b7d957a241fba10efc46a69dd5ace6e95619f014899d811de0f
|
|
BLAKE2b-256 checksum How to use checksums |
0544c485f81dfc7417dce2a64a2304f80f3e6a7e41f57b840eb7fcffe58f7fc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.3 CPython/3.7.4 Darwin/17.7.0
|
Security for splitsio 0.1.0
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.