Skip to main content

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()

Metadata

Release files for cs2api 0.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 cs2api 0.1.3
File Size Uploaded Provenance Actions
cs2api-0.1.3.tar.gz 6.0 kB Without provenance Details for cs2api-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 12.2 kB

Release files / cs2api-0.1.3.tar.gz

Download URL cs2api-0.1.3.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
47edf3067a3e5bfbd5006db888a0f0a66511059ea0bcf18e84e3603be712c09a
BLAKE2b-256 checksum
How to use checksums
7cb95e1c2a1d3631760375dec6470a4db52f386d420ab093924be80895ce3ee3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / cs2api-0.1.3-py3-none-any.whl

Download URL cs2api-0.1.3-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de18074801e82ece52eb91cf84b8352c02ea715b20b059e8dc7d0e03c277cc51
BLAKE2b-256 checksum
How to use checksums
b1097063ee9d0eda7e868f6360638333727d4f23cbeac1c175397cd6885d1613
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for cs2api 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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