Sync and async Python client for the Funstat API (Telegram user/group statistics)
Project description
funstat-api
Python client for the Funstat API — Telegram user and group statistics.
Supports both sync and async usage.
Documentation: https://chizumeiji.github.io/funstat-api/
Installation
pip install funstat-api
Quick Start
Sync
from funstat_api import FunstatClient
fs = FunstatClient("your_token")
# Get user stats
stats = fs.stats("durov")
print(stats.data.total_msg_count)
# Get group members
members = fs.get_group_members("https://t.me/mychat")
# Use as context manager
with FunstatClient("your_token") as fs:
print(fs.ping())
Async
import asyncio
from funstat_api import AsyncFunstatClient
async def main():
async with AsyncFunstatClient("your_token") as fs:
stats = await fs.stats("durov")
print(stats.data.total_msg_count)
asyncio.run(main())
Available Methods
| Method | Description |
|---|---|
ping() |
Check API availability and latency |
get_balance() |
Get current token balance |
resolve_username(username) |
Resolve username to user info |
basic_info_by_id(ids) |
Get basic info by user ID(s) |
stats_min(user) |
Get minimal user statistics |
stats(user) |
Get full user statistics |
messages_count(user) |
Get total message count |
groups_count(user) |
Get number of groups |
get_messages(user, ...) |
Get paginated message list |
get_chats(user) |
Get user's chat list |
get_names(user) |
Get name history |
get_usernames(user) |
Get username history |
get_stickers(user) |
Get used sticker packs |
get_gifts(user) |
Get gift relations |
common_groups(user) |
Get common groups stats |
username_usage(username) |
Who uses or used a username |
get_group_info(group) |
Get group/channel info |
get_group_members(group) |
Get group members |
search_text(query) |
Search messages by text |
user and group arguments accept: numeric ID, @username, or https://t.me/... link.
Dependencies
pydantic >= 2.0requests >= 2.28(sync client)httpx >= 0.24(async client)
License
MIT
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
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 funstat_api-0.1.5.tar.gz.
File metadata
- Download URL: funstat_api-0.1.5.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75eeed49844b999cb87fe2c7b8019e82fe7eed4fa8e02f371bc40134b20e0d99
|
|
| MD5 |
f4bbc7c4fed3fe2edea38cc53585f5f3
|
|
| BLAKE2b-256 |
2518f392ab142e514030a89db83f9deb1abb23b63d43316fe56308accf3333fb
|
File details
Details for the file funstat_api-0.1.5-py3-none-any.whl.
File metadata
- Download URL: funstat_api-0.1.5-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cceb72c709d7ed0729a7a9886c3693acfc196cd6330c5f4ed6ce804561604e4
|
|
| MD5 |
a179789fedbb7ef7fe85303841eb346f
|
|
| BLAKE2b-256 |
6afa2e5f58f543c13948219c77debb448eb859478a8893f3470cae1866fe02f6
|