Python API wrapper for Counter-Strike 2 professional match data via BO3.gg
Project description
CS2 API Wrapper
A Python wrapper for BO3.gg's Counter-Strike 2 professional match statistics API, providing an alternative to HLTV which blocks automated requests.
Features
- Real-time CS2 match data from professional tournaments
- Player and team statistics
- Transfer tracking
- Match predictions
- Async/await support
- Automatic rate limiting handling
Installation
pip install cs2api
Example Usage
from cs2api import CS2
import asyncio
import json
async def main():
async with CS2() as cs2:
# Get live matches
live_matches = await cs2.get_live_matches()
print(json.dumps(live_matches, indent=4))
# Get player transfers
transfers = await cs2.get_player_transfers(31349)
print(json.dumps(transfers, indent=4))
asyncio.run(main())
API METHODS
Match Endpoints
-
get_live_matches() - Current live matches
-
finished() - Recently finished matches
-
get_live_match_snapshot(match_id) - Detailed live match data
-
get_todays_matches() - Today's scheduled matches
-
get_match_details(slug) - Comprehensive match info
Team Endpoints
-
search_teams(query) - Search for teams by name
-
get_team_matches(team_id) - Team's match history
-
get_team_upcoming_matches(team_id) - Team's upcoming matches
-
get_team_news(team_slug) - Team-related news
-
get_team_stats(team_slug) - Team performance stats
-
get_team_data(team_slug) - Basic team info
-
get_team_transfers(team_id) - Team transfer history
Player Endpoints
-
search_players(query) - Search players by name
-
get_player_details(slug) - Player profile data
-
get_player_stats(slug) - Player performance stats
-
get_player_matches(player_id) - Player's match history
-
get_player_transfers(player_id) - Player transfer history
Context Manager (Recommended)
async with CS2() as cs2:
data = await cs2.get_live_matches()
Manual Session Management
cs2 = CS2()
try:
data = await cs2.get_live_matches()
finally:
await cs2.close()
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 cs2api-0.1.3.tar.gz.
File metadata
- Download URL: cs2api-0.1.3.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47edf3067a3e5bfbd5006db888a0f0a66511059ea0bcf18e84e3603be712c09a
|
|
| MD5 |
4e6c90414bab3c1ad34563a075c5f8b8
|
|
| BLAKE2b-256 |
7cb95e1c2a1d3631760375dec6470a4db52f386d420ab093924be80895ce3ee3
|
File details
Details for the file cs2api-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cs2api-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de18074801e82ece52eb91cf84b8352c02ea715b20b059e8dc7d0e03c277cc51
|
|
| MD5 |
de2b68b8eaab32751270b2747685a377
|
|
| BLAKE2b-256 |
b1097063ee9d0eda7e868f6360638333727d4f23cbeac1c175397cd6885d1613
|