# Speedrun API Wrapper
This Python package provides a convenient wrapper for the Speedrun API. It simplifies the process of interacting with the API by offering classes and methods for accessing user, game, run, and various other Speedrun-related data!
If I forgot some API tell me, i'll work on it.
Installation
you can install it using pip:
```bash
pip install speedruncomapi
```
# Usage
Importing the Package
```py
from speedruncomapi import User, Game, Run, Region, Platform, Developer, Engine, GameType, Genre, Guest, Leaderboard, Level, Notification, Profile, Publisher, Series, Variables, HiddenAPI
```
or
```py
import speedruncomapi
```
which will lead to having to put speedruncomapi before everything like info = speedruncomapi.User.Info(name="username")
## User
Get User Information
```py
info = User.Info(name="username") # or User.Info(ID="user_id")
print(info)
```
Get Personal Bests
```py
personal_bests = User.PersonalBest(name="username", limit=5)
print(personal_bests)
```
Get Game ID
```py
game_id = Game.get_game_id("game_id_or_name")
print(game_id)
```
Get Categories
```py
categories = Game.get_categories("game_id")
print(categories)
```
Get Category Details
```py
category_details = Game.get_category_details("category_id")
print(category_details)
```
Get Runs
```py
runs = Run.get_runs(user="username", max_data=10)
print(runs)
```
Get Run by ID
```py
run = Run.get_run_by_id("run_id")
print(run)
```
Create Run
```py
new_run = Run.create_run(
auth_token="your_auth_token",
category="category_id",
level="level_id",
date="YYYY-MM-DD",
region="region_id",
platform="platform_id"
)
print(new_run)
```
Update Run Status
```py
updated_run = Run.update_run_status(
auth_token="your_auth_token",
run_id="run_id",
status="accepted",
reason="Looks good!"
)
print(updated_run)
```
Delete Run
```py
deleted_run = Run.delete_run(auth_token="your_auth_token", run_id="run_id")
print(deleted_run)
```
## Region
Get All Regions
```py
regions = Region.get_all_regions()
print(regions)
```
Get Region by ID
```py
region = Region.get_region_by_id("region_id")
print(region)
```
## Platform
Get All Platforms
```py
platforms = Platform.get_all_platforms()
print(platforms)
```
Get Platform by ID
```py
platform = Platform.get_platform_by_id("platform_id")
print(platform)
```
## Developer
Get All Developers
```py
developers = Developer.get_all_developers()
print(developers)
```
Get Developer by ID
```py
developer = Developer.get_developer_by_id("developer_id")
print(developer)
```
## Engine
Get All Engines
```py
engines = Engine.get_all_engines()
print(engines)
```
Get Engine by ID
```py
engine = Engine.get_engine_by_id("engine_id")
print(engine)
```
## GameType
Get All Game Types
```py
game_types = GameType.get_all_gametypes()
print(game_types)
```
Get Game Type by ID
```py
game_type = GameType.get_gametype_by_id("gametype_id")
print(game_type)
```
## Genre
Get All Genres
```py
genres = Genre.get_all_genres()
print(genres)
```
Get Genre by ID
```py
genre = Genre.get_genre_by_id("genre_id")
print(genre)
```
## Guest
Get Guest by Name
```py
guest = Guest.get_guest_by_name("guest_name")
print(guest)
```
## Leaderboard
Get Full Game Leaderboard
```py
leaderboard = Leaderboard.get_full_game_leaderboard("game_id", "category_id")
print(leaderboard)
```
Get Individual Level Leaderboard
```py
level_leaderboard = Leaderboard.get_individual_level_leaderboard("game_id", "level_id", "category_id")
print(level_leaderboard)
```
## Level
Get Level by ID
```py
level = Level.get_level_by_id("level_id")
print(level)
```
Get Level Categories
```py
categories = Level.get_level_categories("level_id")
print(categories)
```
Get Level Variables
```py
variables = Level.get_level_variables("level_id")
print(variables)
Get Level Records
```py
records = Level.get_level_records("level_id")
print(records)
```
## Notification
Get Notifications
```py
notifications = Notification.get_notifications()
print(notifications)
```
## Profile
Get Profile
```py
profile = Profile.get_profile(api_key="your_api_key")
print(profile)
Get Profile Notifications
```py
profile_notifications = Profile.get_notifications(api_key="your_api_key")
print(profile_notifications)
```
##Publisher
Get Publishers
```py
publishers = Publisher.get_publishers()
print(publishers)
Get Publisher by ID
```py
publisher = Publisher.get_publisher("publisher_id")
print(publisher)
```
## Series
Get Series
```py
series = Series.get_series()
print(series)
```
Get Series by ID
```py
series_by_id = Series.get_series_by_id("series_id")
print(series_by_id)
```
Get Games in Series
```py
games_in_series = Series.get_games_in_series("series_id")
print(games_in_series)
```
## Variables
Get Variable by ID
```py
variable = Variables.get_variable("variable_id")
print(variable)
```
Get Variables for Game
```py
variables_for_game = Variables.get_variables_for_game("game_id")
print(variables_for_game)
```
Get Variables for Category
```py
variables_for_category = Variables.get_variables_for_category("category_id")
print(variables_for_category)
```
Get Variables for Level
```py
variables_for_level = Variables.get_variables_for_level("level_id")
print(variables_for_level)
```
## HiddenAPI
Send Message
```py
hidden_api = HiddenAPI(csrf_token="your_csrf_token", cookie_session="your_cookie_session")
response = hidden_api.send_message(recipient_ids=["recipient_id"], text="Hello!")
print(response)
```
Get Conversations
```py
conversations = hidden_api.get_conversations(limit=5)
print(conversations)
```
Get Conversation Messages
```py
messages = hidden_api.get_conversation_messages(conversation_id="conversation_id", mark_as_read=True)
print(messages)
```
Get Moderations Runs
```py
moderation_runs = api.get_moderation_runs(
game_id='game_id_here',
verified=0, # No verified parameter: Everything, 0: unverified, 1: verified, 2: rejected
page=1,
limit=20
)
print(moderation_runs)
```
## Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your changes. Ensure that your code adheres to the existing coding style and includes appropriate tests.
## License
This project is licensed under the MIT License. See the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "speedruncomapi",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, wrapper, api, speedrun",
"author": "Sallie Lay",
"author_email": "mail@neuralnine.com",
"download_url": "https://files.pythonhosted.org/packages/87/0f/b0dd74af304b2c0e469050822615199fed72ce62cbc9721666a900e5d9e8/speedruncomapi-0.0.31.tar.gz",
"platform": null,
"description": "# Speedrun API Wrapper\r\nThis Python package provides a convenient wrapper for the Speedrun API. It simplifies the process of interacting with the API by offering classes and methods for accessing user, game, run, and various other Speedrun-related data!\r\n\r\nIf I forgot some API tell me, i'll work on it.\r\n\r\nInstallation\r\n\r\nyou can install it using pip:\r\n\r\n```bash\r\npip install speedruncomapi\r\n```\r\n\r\n# Usage\r\nImporting the Package\r\n\r\n```py\r\n\r\nfrom speedruncomapi import User, Game, Run, Region, Platform, Developer, Engine, GameType, Genre, Guest, Leaderboard, Level, Notification, Profile, Publisher, Series, Variables, HiddenAPI\r\n```\r\n\r\nor \r\n\r\n```py\r\nimport speedruncomapi\r\n```\r\nwhich will lead to having to put speedruncomapi before everything like info = speedruncomapi.User.Info(name=\"username\")\r\n\r\n## User\r\n\r\nGet User Information\r\n\r\n```py\r\n\r\ninfo = User.Info(name=\"username\") # or User.Info(ID=\"user_id\")\r\nprint(info)\r\n\r\n```\r\nGet Personal Bests\r\n\r\n```py\r\n\r\npersonal_bests = User.PersonalBest(name=\"username\", limit=5)\r\nprint(personal_bests)\r\n```\r\n\r\n\r\nGet Game ID\r\n\r\n```py\r\n\r\ngame_id = Game.get_game_id(\"game_id_or_name\")\r\nprint(game_id)\r\n\r\n```\r\n\r\nGet Categories\r\n```py\r\n\r\ncategories = Game.get_categories(\"game_id\")\r\nprint(categories)\r\n```\r\n\r\nGet Category Details\r\n```py\r\n\r\ncategory_details = Game.get_category_details(\"category_id\")\r\nprint(category_details)\r\n```\r\nGet Runs\r\n```py\r\n\r\nruns = Run.get_runs(user=\"username\", max_data=10)\r\nprint(runs)\r\n\r\n```\r\nGet Run by ID\r\n```py\r\n\r\nrun = Run.get_run_by_id(\"run_id\")\r\nprint(run)\r\n```\r\n\r\nCreate Run\r\n```py\r\n\r\nnew_run = Run.create_run(\r\n auth_token=\"your_auth_token\",\r\n category=\"category_id\",\r\n level=\"level_id\",\r\n date=\"YYYY-MM-DD\",\r\n region=\"region_id\",\r\n platform=\"platform_id\"\r\n)\r\nprint(new_run)\r\n\r\n```\r\nUpdate Run Status\r\n```py\r\n\r\nupdated_run = Run.update_run_status(\r\n auth_token=\"your_auth_token\",\r\n run_id=\"run_id\",\r\n status=\"accepted\",\r\n reason=\"Looks good!\"\r\n)\r\nprint(updated_run)\r\n```\r\n\r\nDelete Run\r\n```py\r\n\r\ndeleted_run = Run.delete_run(auth_token=\"your_auth_token\", run_id=\"run_id\")\r\nprint(deleted_run)\r\n\r\n```\r\n\r\n## Region\r\nGet All Regions\r\n```py\r\n\r\nregions = Region.get_all_regions()\r\nprint(regions)\r\n\r\n```\r\n\r\nGet Region by ID\r\n```py\r\n\r\nregion = Region.get_region_by_id(\"region_id\")\r\nprint(region)\r\n\r\n```\r\n\r\n## Platform\r\nGet All Platforms\r\n```py\r\n\r\nplatforms = Platform.get_all_platforms()\r\nprint(platforms)\r\n```\r\nGet Platform by ID\r\n```py\r\n\r\nplatform = Platform.get_platform_by_id(\"platform_id\")\r\nprint(platform)\r\n```\r\n\r\n## Developer\r\nGet All Developers\r\n```py\r\n\r\ndevelopers = Developer.get_all_developers()\r\nprint(developers)\r\n```\r\nGet Developer by ID\r\n```py\r\n\r\ndeveloper = Developer.get_developer_by_id(\"developer_id\")\r\nprint(developer)\r\n```\r\n## Engine\r\nGet All Engines\r\n```py\r\n\r\nengines = Engine.get_all_engines()\r\nprint(engines)\r\n```\r\nGet Engine by ID\r\n```py\r\n\r\nengine = Engine.get_engine_by_id(\"engine_id\")\r\nprint(engine)\r\n```\r\n## GameType\r\nGet All Game Types\r\n```py\r\n\r\ngame_types = GameType.get_all_gametypes()\r\nprint(game_types)\r\n```\r\n\r\nGet Game Type by ID\r\n```py\r\n\r\ngame_type = GameType.get_gametype_by_id(\"gametype_id\")\r\nprint(game_type)\r\n```\r\n## Genre\r\nGet All Genres\r\n```py\r\n\r\ngenres = Genre.get_all_genres()\r\nprint(genres)\r\n```\r\nGet Genre by ID\r\n```py\r\n\r\ngenre = Genre.get_genre_by_id(\"genre_id\")\r\nprint(genre)\r\n\r\n```\r\n## Guest\r\nGet Guest by Name\r\n```py\r\n\r\nguest = Guest.get_guest_by_name(\"guest_name\")\r\nprint(guest)\r\n```\r\n## Leaderboard\r\nGet Full Game Leaderboard\r\n\r\n```py\r\n\r\nleaderboard = Leaderboard.get_full_game_leaderboard(\"game_id\", \"category_id\")\r\nprint(leaderboard)\r\n\r\n```\r\n\r\nGet Individual Level Leaderboard\r\n```py\r\n\r\nlevel_leaderboard = Leaderboard.get_individual_level_leaderboard(\"game_id\", \"level_id\", \"category_id\")\r\nprint(level_leaderboard)\r\n```\r\n## Level\r\nGet Level by ID\r\n```py\r\n\r\nlevel = Level.get_level_by_id(\"level_id\")\r\nprint(level)\r\n```\r\nGet Level Categories\r\n```py\r\n\r\ncategories = Level.get_level_categories(\"level_id\")\r\nprint(categories)\r\n```\r\nGet Level Variables\r\n```py\r\n\r\nvariables = Level.get_level_variables(\"level_id\")\r\nprint(variables)\r\nGet Level Records\r\n```py\r\n\r\nrecords = Level.get_level_records(\"level_id\")\r\nprint(records)\r\n```\r\n## Notification\r\nGet Notifications\r\n```py\r\n\r\nnotifications = Notification.get_notifications()\r\nprint(notifications)\r\n```\r\n## Profile\r\nGet Profile\r\n```py\r\n\r\nprofile = Profile.get_profile(api_key=\"your_api_key\")\r\nprint(profile)\r\nGet Profile Notifications\r\n```py\r\n\r\nprofile_notifications = Profile.get_notifications(api_key=\"your_api_key\")\r\nprint(profile_notifications)\r\n```\r\n##Publisher\r\nGet Publishers\r\n```py\r\n\r\npublishers = Publisher.get_publishers()\r\nprint(publishers)\r\nGet Publisher by ID\r\n```py\r\n\r\npublisher = Publisher.get_publisher(\"publisher_id\")\r\nprint(publisher)\r\n```\r\n## Series\r\nGet Series\r\n```py\r\n\r\nseries = Series.get_series()\r\nprint(series)\r\n```\r\nGet Series by ID\r\n```py\r\n\r\nseries_by_id = Series.get_series_by_id(\"series_id\")\r\nprint(series_by_id)\r\n```\r\nGet Games in Series\r\n```py\r\n\r\ngames_in_series = Series.get_games_in_series(\"series_id\")\r\nprint(games_in_series)\r\n```\r\n## Variables\r\nGet Variable by ID\r\n```py\r\n\r\nvariable = Variables.get_variable(\"variable_id\")\r\nprint(variable)\r\n\r\n```\r\nGet Variables for Game\r\n```py\r\n\r\nvariables_for_game = Variables.get_variables_for_game(\"game_id\")\r\nprint(variables_for_game)\r\n```\r\nGet Variables for Category\r\n```py\r\n\r\nvariables_for_category = Variables.get_variables_for_category(\"category_id\")\r\nprint(variables_for_category)\r\n```\r\nGet Variables for Level\r\n```py\r\n\r\nvariables_for_level = Variables.get_variables_for_level(\"level_id\")\r\nprint(variables_for_level)\r\n```\r\n\r\n## HiddenAPI\r\nSend Message\r\n```py\r\n\r\nhidden_api = HiddenAPI(csrf_token=\"your_csrf_token\", cookie_session=\"your_cookie_session\")\r\nresponse = hidden_api.send_message(recipient_ids=[\"recipient_id\"], text=\"Hello!\")\r\nprint(response)\r\n```\r\nGet Conversations\r\n```py\r\n\r\nconversations = hidden_api.get_conversations(limit=5)\r\nprint(conversations)\r\n```\r\nGet Conversation Messages\r\n```py\r\n\r\nmessages = hidden_api.get_conversation_messages(conversation_id=\"conversation_id\", mark_as_read=True)\r\nprint(messages)\r\n```\r\nGet Moderations Runs\r\n\r\n```py\r\nmoderation_runs = api.get_moderation_runs(\r\n game_id='game_id_here',\r\n verified=0, # No verified parameter: Everything, 0: unverified, 1: verified, 2: rejected\r\n page=1,\r\n limit=20\r\n)\r\nprint(moderation_runs)\r\n\r\n```\r\n## Contributing\r\nContributions are welcome! Please fork the repository and submit a pull request with your changes. Ensure that your code adheres to the existing coding style and includes appropriate tests.\r\n\r\n## License\r\nThis project is licensed under the MIT License. See the LICENSE file for details.\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python API wrapper for Speedrun.com",
"version": "0.0.31",
"project_urls": null,
"split_keywords": [
"python",
" wrapper",
" api",
" speedrun"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "869b9ba31aee3024bda463dc9738ac7fc45e0a35915b19b99b5b02fa2a9260e3",
"md5": "6af95e21bb0314f3ab3464419dea8175",
"sha256": "3ee0352f3f8f14d02c8f810c4ee51f4cb24c91f15f94aedbd0b991481cf4c751"
},
"downloads": -1,
"filename": "speedruncomapi-0.0.31-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6af95e21bb0314f3ab3464419dea8175",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6840,
"upload_time": "2024-08-05T14:55:05",
"upload_time_iso_8601": "2024-08-05T14:55:05.941284Z",
"url": "https://files.pythonhosted.org/packages/86/9b/9ba31aee3024bda463dc9738ac7fc45e0a35915b19b99b5b02fa2a9260e3/speedruncomapi-0.0.31-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "870fb0dd74af304b2c0e469050822615199fed72ce62cbc9721666a900e5d9e8",
"md5": "01f45580289ff4a758a2052af88e7bfd",
"sha256": "37354fe894683049bf6e8dac64d56b0f36b51681992d054422c2aff443ed1db3"
},
"downloads": -1,
"filename": "speedruncomapi-0.0.31.tar.gz",
"has_sig": false,
"md5_digest": "01f45580289ff4a758a2052af88e7bfd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8617,
"upload_time": "2024-08-05T14:55:07",
"upload_time_iso_8601": "2024-08-05T14:55:07.330609Z",
"url": "https://files.pythonhosted.org/packages/87/0f/b0dd74af304b2c0e469050822615199fed72ce62cbc9721666a900e5d9e8/speedruncomapi-0.0.31.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-05 14:55:07",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "speedruncomapi"
}