Skip to main content

srcom.py

This project is a work in progress.

An asynchronous Python wrapper for the speedrun.com REST API. Currently it focuses on the most important parts of the API, i.e., games, runs, users. It follows an object-oriented design, with methods integrating different parts of the API together and allowing simple retrieval of information.

Simple Example

import asyncio

import srcom


async def main():
    client = srcom.Client()

    # Exact match by abbreviation
    game = await client.get_game(abbreviation="khfm")

    # Make sure to close the HTTP session!
    await client.close()

    # You can also use a context manager to automatically close the client
    async with srcom.Client() as client:
        # Fuzzy search game by name
        game = await client.get_game(name="Kingdom Hearts II")
        # You can get any resource directly from its ID as well
        game = await srcom.Game.from_id(game.id, client)

        # Gets the 3 fastest runs for the default category
        for run in await game.leaderboard(3):
            await print_run(run)

        print()

        # Returns at most 20 runs (default limit in API)
        for run in await game.runs():
            await print_run(run)

        print()

        # Gets the WR for the default category for the game
        record = await game.record()
        await print_run(record)


async def print_run(run):
    # Retrieve the runner
    player = await run.player()
    print("{}    {}    {}    {}".format(
        run.time,
        player.name,
        player.country or 'NONE',  # player.country can be None
        (await run.category()).name,
        run.link,  # direct link to run on speedrun.com
    ))


asyncio.get_event_loop().run_until_complete(main())

Metadata

Release files for srcom.py 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for srcom.py 0.0.2
File Size Uploaded
srcom.py-0.0.2.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for srcom.py 0.0.2
File Interpreter ABI Platform
srcom.py-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 16.7 kB

Release files / srcom.py-0.0.2.tar.gz

Download URL srcom.py-0.0.2.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4e0d291aafbfddf44a4b571743b269b95bfd29d0b0fc2bc5059696669f2bf22c
BLAKE2b-256 checksum
How to use checksums
4188a6d8c1681fc6adc7316b2e5b4dba729e2ca2239e202cc83d05d18846f2b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.6

Release files / srcom.py-0.0.2-py3-none-any.whl

Download URL srcom.py-0.0.2-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff50d057aa925d6b8044389bc7f412a3d2dcec0daff9478766ff9016435d9d12
BLAKE2b-256 checksum
How to use checksums
06abeb8638b89df1f2a00a0181ae6e2f25450eb89503b4d7eaedc5c66cac8d78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page