Skip to main content

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.

PyPI Version Python Versions

PyPI Downloads

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

cs2api-0.1.3.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cs2api-0.1.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

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

Hashes for cs2api-0.1.3.tar.gz
Algorithm Hash digest
SHA256 47edf3067a3e5bfbd5006db888a0f0a66511059ea0bcf18e84e3603be712c09a
MD5 4e6c90414bab3c1ad34563a075c5f8b8
BLAKE2b-256 7cb95e1c2a1d3631760375dec6470a4db52f386d420ab093924be80895ce3ee3

See more details on using hashes here.

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

Hashes for cs2api-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 de18074801e82ece52eb91cf84b8352c02ea715b20b059e8dc7d0e03c277cc51
MD5 de2b68b8eaab32751270b2747685a377
BLAKE2b-256 b1097063ee9d0eda7e868f6360638333727d4f23cbeac1c175397cd6885d1613

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page