Tiny Hi-Rez API wrapper
Project description
Charybdis
Tiny Hi-Rez API Python wrapper that I wrote to use in my Smite related projects (and to play around with async).
Hi-Rez API documentation: https://webcdn.hirezstudios.com/hirez-studios/legal/smite-api-developer-guide.pdf
See the Hi-Rez API documentation for available methods and their parameters. The structure of the returned values is not described though, so some work is required to figure out what information can actually be obtained from the API.
Other Python wrappers:
Installation
pip install charybdis
Usage
Sync
import os
import charybdis
api = charybdis.Api(
# These are also the default values.
base_url=charybdis.Api.SMITE_PC_URL,
dev_id=os.getenv("SMITE_DEV_ID"),
auth_key=os.getenv("SMITE_AUTH_KEY"),
)
# Returns deserialized JSON.
scylla_skins = api.call_method(
"getgodskins", # Method name.
"1988", # God ID - Scylla.
"1", # Language ID - English.
)
for scylla_skin in scylla_skins:
print(scylla_skin["skin_name"])
# Output:
# Standard Scylla
# Bewitching Bunny
# Child's Play
# COG Scylla
# and many more...
Async
import asyncio
import charybdis
async def main() -> None:
async with charybdis.Api() as api:
patch_info_task = asyncio.create_task(api.acall_method("getpatchinfo"))
gods_task = asyncio.create_task(api.acall_method("getgods", "1"))
patch_info = await patch_info_task
gods = await gods_task
newest_god = ""
for god in gods:
if god["latestGod"] == "y":
newest_god = god["Name"]
break
print(
f"The current patch is {patch_info['version_string']}"
+ f" and the newest god is {newest_god}."
)
asyncio.run(main())
# Output:
# The current patch is 9.12 and the newest god is Maui.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
charybdis-2.0.0.tar.gz
(5.1 kB
view details)
Built Distribution
File details
Details for the file charybdis-2.0.0.tar.gz
.
File metadata
- Download URL: charybdis-2.0.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7eff3a855aaf86e08e3ffb2e23c0f35357f7c0b6f2313a06acf1d398dd1d16f |
|
MD5 | 6c91ed29454aed7b345ff0b374cf96d1 |
|
BLAKE2b-256 | 1cd4d4371722b13b1e3ec22132a3303692de27bc9230c9d7ca66f274b6395ea6 |
File details
Details for the file charybdis-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: charybdis-2.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 623c3ddbbd78ab499ec7b59eb4d3d945bd3e9da5ce9eccbe1930f455dce4c228 |
|
MD5 | 5c3a42e0f28b7b1919da253a0f6fffeb |
|
BLAKE2b-256 | 256ff3c903397edcf888655cef720fad6f64133bb4c452dd3cb898cf4766c760 |