Skip to main content

topstats pypi downloads

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)

Source distribution for topstats 1.1.3
File Size Uploaded
topstats-1.1.3.tar.gz 12.0 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

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