topstats

A simple API wrapper for topstats.gg written in Python.
Getting started
Make sure you already have an API token handy. See this page on how to retrieve it.
After that, run the following command in your terminal:
pip install topstats
Example
For more information, please read the documentation.
# Import the module.
import topstats
import asyncio
import os
async def main() -> None:
# Declare the client.
async with topstats.Client(os.getenv('TOPSTATS_TOKEN')) as ts:
# Fetch a bot from its ID.
bot = await ts.get_bot(432610292342587392)
print(bot)
# Fetch topstats.gg's top bots.
bots = await ts.get_top_bots(sort_by=topstats.SortBy.server_count())
for b in bots:
print(b)
# Search for bots that has the name 'MEE6.'
mee6_bots = await ts.search_bots(name='MEE6')
for b in mee6_bots:
print(b)
# Search for anime-tagged bots.
anime_bots = await ts.search_bots(tag='anime')
for b in anime_bots:
print(b)
# Fetch a bot's historical server count.
sc = await ts.get_historical_bot_server_count(432610292342587392)
for server_count in sc:
print(server_count)
# Compare two bots' historical server count.
vs = await ts.compare_bot_server_count(432610292342587392, 437808476106784770)
for first, second in vs:
print(first, second)
# Compare up to four bots' historical total vote count.
vs2 = await ts.compare_bot_total_votes(
topstats.Period.LAST_YEAR,
339254240012664832,
432610292342587392,
408785106942164992,
437808476106784770
)
for first, second, third, fourth in vs2:
print(first, second, third, fourth)
if __name__ == '__main__':
asyncio.run(main())
Metadata
Release files for topstats 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| topstats-1.1.3.tar.gz | 12.0 kB | Without provenance | Details for topstats-1.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| topstats-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for topstats-1.1.3-py3-none-any.whl |
Total release size: 28.4 kB
Release files / topstats-1.1.3.tar.gz
| Download URL | topstats-1.1.3.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82dabbf14bffc2c04df035b74d42c9d6f98e3e269c9a6a342d476a92eeaae768
|
|
BLAKE2b-256 checksum How to use checksums |
a293a65a168596bae1798c5f4cf5d3a069029e8281179857ccc425e7496067f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / topstats-1.1.3-py3-none-any.whl
| Download URL | topstats-1.1.3-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e86cb408fa3bfb028e11bf77f0ac79d669070915b537674b687fd00a5aa69e8a
|
|
BLAKE2b-256 checksum How to use checksums |
faa264882438ed417c06576bbca39f2637c5f17058652971aec10eb801136960
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for topstats 1.1.3
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.