Skip to main content

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:

  • items
  • has_more
  • next_cursor
  • count

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.

Metadata

Release files for sotipy 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sotipy 2.1.0
File Size Uploaded Provenance Actions
sotipy-2.1.0.tar.gz 21.0 kB Without provenance Details for sotipy-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sotipy 2.1.0
File Interpreter ABI Platform Actions
sotipy-2.1.0-py3-none-any.whl Python 3 none any Details for sotipy-2.1.0-py3-none-any.whl

Total release size: 41.0 kB

Release files / sotipy-2.1.0.tar.gz

Download URL sotipy-2.1.0.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2fb0a84147ca666d69ee5128b170f65b7415399aa2d44e008cc802bc09a97eb7
BLAKE2b-256 checksum
How to use checksums
496f82779a96f82394a1217a3dc1f17a8f1c5b2b6fc2c3c54cabac3cd4dd66f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / sotipy-2.1.0-py3-none-any.whl

Download URL sotipy-2.1.0-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66f766e8348acc85ba65125c4a48be21c5085514c2bb4d3ecd4abb54237d2726
BLAKE2b-256 checksum
How to use checksums
a9050b9291776eb04d035ed80daf6e4b10144b1cf991e29c289f5a965811c4cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Security for sotipy 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page