Skip to main content

Asynchronous wrapper for UnbelievaBoat's API written in python

Project description

PyPI status PyPI version fury.io PyPI license

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


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.8a0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

unbelipy-0.0.8a0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file unbelipy-0.0.8a0.tar.gz.

File metadata

  • Download URL: unbelipy-0.0.8a0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.9 Windows/10

File hashes

Hashes for unbelipy-0.0.8a0.tar.gz
Algorithm Hash digest
SHA256 69fba05cab8fe84e6b0edf82e53cd8bbff87bbceb8b8f09f77af94edb1367dac
MD5 57ecf25eaa793961a1fa91526d3da480
BLAKE2b-256 56c1afab0c45520e0dc2b33d6882b1c53308eff5a593cc2b2b3e6d42a64a75f9

See more details on using hashes here.

File details

Details for the file unbelipy-0.0.8a0-py3-none-any.whl.

File metadata

  • Download URL: unbelipy-0.0.8a0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.9 Windows/10

File hashes

Hashes for unbelipy-0.0.8a0-py3-none-any.whl
Algorithm Hash digest
SHA256 dd996e3ff836532f7758a287623d1fc1303c937da93ba66b71f0caba3bdb87ff
MD5 8f9ba7c0d7dbb8f94b1e09aed9bb1802
BLAKE2b-256 770167a5775e6ead99d1f4e57c9d39f7bb2a8d6619117f0c76a489f3ceaf5148

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page