Official Python SDK for Soti Discord Bot Catalog API
Project description
Sotipy
Production Python SDK for Soti / FlareHub API.
Installation
pip install sotipy
Quick Start
from sotipy import Soti
soti = Soti("YOUR_SOTI_API_TOKEN")
bots = soti.get_approved_bots()
print(len(bots))
Async Quick Start
from sotipy import AsyncSoti
async with AsyncSoti("YOUR_SOTI_API_TOKEN") as soti:
health = await soti.get_api_health()
await soti.post_bot_stats("1006946815050006539", {
"servers": 5000,
"users": 50000,
"shards": 2,
})
Bot Autopost
from discord.ext import commands
from sotipy import Soti
bot = commands.Bot(command_prefix="!")
soti = Soti("YOUR_SOTI_API_TOKEN")
async def get_stats():
return {
"servers": len(bot.guilds),
"members": len(bot.users),
"shards": bot.shard_count,
}
def on_success(_):
print("stats posted")
autopost = (
soti.autopost(interval="15m")
.init_stats(get_stats)
.on_success(on_success)
)
@bot.event
async def on_ready():
autopost.start(bot.user.id)
bot.run("YOUR_DISCORD_BOT_TOKEN")
Constructor
Soti(
token_or_base_url=None,
api_token=None,
bot_token=None,
base_url=None,
site_base_url=None,
api_base_url=None,
timeout=10.0,
retries=2,
retry_delay=0.25,
headers=None,
user_agent=None,
cookie=None,
)
- If first argument is URL -> treated as base URL.
- If first argument is not URL -> treated as API token.
- Default site base:
https://mvxxl.xyz - Default api base:
https://api.mvxxl.xyz
Core Methods
get_api_health()get_approved_bots(category=None, search=None)get_new_bots()search_bots(query)get_bot(bot_id, strict=False)get_bot_stats(bot_id)get_bot_stats_history(bot_id, limit=20, cursor=None, token=None, api_token=None, bot_token=None)post_bot_stats(bot_id, stats)send_bot_metrics(bot_id, servers=None, users=None, shards=None, ...)
Account / Token Methods
get_session_info()get_user_token()regenerate_user_token()get_my_bots()get_bot_token(bot_id)regenerate_bot_token(bot_id)
Community Methods
get_reviews(bot_id, limit=20, cursor=None)submit_review(bot_id, rating, comment)upvote_bot(bot_id, stiosp_token=None, pow_counter=None)get_upvote_cooldown(bot_id)get_upvote_count(bot_id, period="current")
get_upvote_cooldown(bot_id) is wired to /api/v1/bots/{bot_id}/upvotes/cooldown.
Webhook Methods
create_webhook(bot_id, url, events)list_webhooks()delete_webhook(webhook_id)get_webhook_deliveries(webhook_id, limit=20, cursor=None)test_webhook(webhook_id)
Verify Webhook Signatures
from sotipy import verify_webhook_signature
is_valid = verify_webhook_signature(
body=request_body,
signature=request_headers["X-Webhook-Signature"],
secret="WEBHOOK_SECRET",
)
Pagination
Cursor-paginated methods return PaginatedResult with:
itemshas_morenext_cursorcount
Error Handling
from sotipy import Soti, SotiAPIError, SotiConnectionError, SotiValidationError
soti = Soti("YOUR_TOKEN")
try:
soti.get_bot_stats("123")
except SotiValidationError as e:
print("validation:", e)
except SotiAPIError as e:
print("api:", e.status_code, e.code, e)
except SotiConnectionError as e:
print("connection:", e)
Context Manager
from sotipy import Soti
with Soti("YOUR_TOKEN") as soti:
print(soti.get_api_health())
License
Soti Non-Commercial License. You may use, copy, modify, and redistribute this SDK for non-commercial purposes. Commercial services, paid products, paid hosting, paid support, resale, or other revenue-generating use require prior written permission.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sotipy-2.1.0.tar.gz.
File metadata
- Download URL: sotipy-2.1.0.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fb0a84147ca666d69ee5128b170f65b7415399aa2d44e008cc802bc09a97eb7
|
|
| MD5 |
3120fb2693f90c574ed683a46a11034a
|
|
| BLAKE2b-256 |
496f82779a96f82394a1217a3dc1f17a8f1c5b2b6fc2c3c54cabac3cd4dd66f6
|
File details
Details for the file sotipy-2.1.0-py3-none-any.whl.
File metadata
- Download URL: sotipy-2.1.0-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66f766e8348acc85ba65125c4a48be21c5085514c2bb4d3ecd4abb54237d2726
|
|
| MD5 |
2ebb112a82a498a1872eb4f58f5d4169
|
|
| BLAKE2b-256 |
a9050b9291776eb04d035ed80daf6e4b10144b1cf991e29c289f5a965811c4cd
|