Python API wrapper for Rocket.Chat's REST API, enabling developers to programmatically interact with Rocket.Chat servers for chat automation, bot development, and integration purposes
—
Server statistics and metrics for monitoring Rocket.Chat server usage, performance, and system information.
def statistics(self, **kwargs):
"""
Get server statistics.
Parameters:
- refresh (bool, optional): Force statistics refresh
Returns:
requests.Response: Comprehensive server statistics
"""
def statistics_list(self, **kwargs):
"""
List statistics data.
Parameters:
- offset (int, optional): Number of items to skip
- count (int, optional): Number of items to return
Returns:
requests.Response: Statistics list
"""StatisticsObject = {
"uniqueId": "str", # Server unique identifier
"installedAt": "datetime", # Installation date
"version": "str", # Rocket.Chat version
"totalUsers": "int", # Total user count
"activeUsers": "int", # Active user count
"totalRooms": "int", # Total room count
"totalChannels": "int", # Public channel count
"totalPrivateGroups": "int", # Private group count
"totalDirect": "int", # Direct message count
"totlalLivechat": "int", # LiveChat room count
"totalMessages": "int", # Total message count
"totalThreads": "int", # Total thread count
"totalLivechatVisitors": "int", # LiveChat visitor count
"uploads": { # Upload statistics
"total": "int",
"totalSize": "int"
},
"federation": "dict", # Federation statistics
"importer": "dict", # Import statistics
"integrations": "dict", # Integration statistics
"migration": "dict", # Migration statistics
"push": "dict", # Push notification statistics
"usage": "dict", # Usage statistics
"apps": "dict", # App statistics
"services": "dict" # Service statistics
}# Get server statistics
stats = rocket.statistics()
stats_data = stats.json()
print(f"Server Version: {stats_data['version']}")
print(f"Total Users: {stats_data['totalUsers']}")
print(f"Active Users: {stats_data['activeUsers']}")
print(f"Total Messages: {stats_data['totalMessages']}")
print(f"Total Rooms: {stats_data['totalRooms']}")
# Get upload statistics
uploads = stats_data['uploads']
print(f"Total Uploads: {uploads['total']}")
print(f"Upload Size: {uploads['totalSize']} bytes")
# Force refresh statistics
fresh_stats = rocket.statistics(refresh=True)
# List statistics (paginated)
stats_list = rocket.statistics_list(count=50)Install with Tessl CLI
npx tessl i tessl/pypi-rocketchat-a-p-i