Asynchronous wrapper for UnbelievaBoat's API written in python
Project description
unbelipy
Asynchronous wrapper for UnbelievaBoat's API written in python
Characteristics
- Easy to use
- Full error handling
- Type hinted and readable code
Project status
Early alpha and as such unsuitable for production.
Installation
pip install unbelipy
Use:
from unbelipy import UnbeliClient
import asyncio
TOKEN = "Token generated through Unbelievaboat's portal"
client = UnbeliClient(token=TOKEN)
async def main():
# get guild information
guild_info = await client.get_guild(guild_id=305129477627969547)
print(guild_info)
# get guild leaderboard
guild_leaderboard = await client.get_leaderboard(guild_id=305129477627969547)
print(guild_leaderboard)
# get user balance
balance = await client.get_balance(guild_id=305129477627969547, member_id=80821761460928512)
print(balance)
# put balance (set to x amount)
balance = await client.set_balance(guild_id=305129477627969547,
member_id=80821761460928512,
cash=1000,
reason="Showing off put method")
# patch balance (increment or decrement by x amount)
balance = await client.edit_balance(guild_id=305129477627969547,
member_id=80821761460928512,
cash=-500,
reason="Showing off patch method")
print(balance)
asyncio.run(main())
"balance" is a returned Dataclass with balance information containing:
- total: total amount of currency (cash + bank)
- bank: amount in bank
- cash: amount in cash
- user_id: id of the user for which the amount is set
- guild_id: id for the guild the user belongs to
- rank: rank of the user in the guild according to query parameters
"guild_info" is a dataclass with guild info containing:
- id
- name
- icon
- owner_id
- member_count
- symbol (currency)
UnbeliClient also has a rate_limit_data attribute with information returned with each request from the API.
Nots:
- '-Infinity' is accepted by the API as a parameter for cash or bank (edit_balance and set_balance), but it doesn't work.
- For the moment concurrent operations will still trigger 429 errors, it's still being worked on.
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
unbelipy-0.0.7a0.tar.gz
(8.3 kB
view hashes)
Built Distribution
Close
Hashes for unbelipy-0.0.7a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41d48b0305f4ce859633311143584d1b64e45272a1c47a206a3ccbe9068f4be0 |
|
MD5 | 8faa480c27817112f66e72baa7cd4146 |
|
BLAKE2b-256 | b3147dd195d9b458e2840da58226ba8fffabfda042d80b3a9e9f2fbb6259ba40 |