An unofficial, async-ready wrapper for the Tatsu API.
Project description
Tatsu
A lightweight and asynchronous wrapper for Tatsu v1 API, written in Python. Supports every documented API endpoint.
Shoutout to the discord.py wrapper for being an inspiration and providing a strong example for implementation.
Note: Modifying a user's scores/points isn't possible without certain Discord permissions. See the API docs for more info.
Installing
Uploading to PyPI is being considered. For now, to install the library, run the following command:
# Linux/macOS
python3 -m pip install -U git+https://github.com/Sachaa-Thanasius/Tatsu@main
# Windows
py -3 -m pip install -U git+https://github.com/Sachaa-Thanasius/Tatsu@main
Quick Example
import asyncio
import tatsu_api as tatsu
async def main() -> None:
"""Example function."""
api_key = "API_KEY"
test_guild = 173184118492889089 # The Discord ID of the official Tatsu server.
test_user = 1234567891 # Random Discord user ID.
# The client can be used as a context manager to handle closing of the
# internal HTTP session.
async with tatsu.Client(api_key) as client:
profile = await client.get_user(test_user)
print(f"{profile.username} currently has {profile.credits} credits and {profile.reputation} reputation.")
username = profile.username
ranking = await client.get_member_ranking(test_guild, test_user, "all")
print(f"On the Tatsu server, {username} ranks at {ranking.rank} for all time.")
before_points = await client.get_member_points(test_guild, test_user)
print(f"{username} - Points before update: {before_points.points}")
after_points = await client.update_member_points(test_guild, test_user, -10)
print(f"{username} - Points after update: {after_points.points}")
asyncio.run(main())
Take a look at the examples directory for more.
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
tatsu_api-1.0.0.tar.gz
(13.5 kB
view hashes)
Built Distribution
tatsu_api-1.0.0-py3-none-any.whl
(12.0 kB
view hashes)
Close
Hashes for tatsu_api-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0fbd50df6ff222446ffc117c34f5b8c6772f5a049d5c4f3b2c4f3ba9c38a1af |
|
MD5 | 4ad038ec861e9105f3130c950c6faf0f |
|
BLAKE2b-256 | 03e8442411717438ddd948466424711a6eceb7a04eb6a68cc8f9733afa91f1b2 |