kashrock 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kashrock-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 KashRock Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: kashrock
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the KashRock esports API — props, odds, matches, and scores.
5
+ Author-email: KashRock <ovitalszn@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://www.kashrock.com
8
+ Project-URL: Documentation, https://www.kashrock.com/docs
9
+ Project-URL: API, https://kashrock.up.railway.app
10
+ Project-URL: Repository, https://github.com/ovitalszn-cyber/kashrock-python
11
+ Keywords: esports,api,cs2,valorant,dota,props,odds
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Internet :: WWW/HTTP
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: httpx<0.29,>=0.26
22
+ Dynamic: license-file
23
+
24
+ # KashRock Python SDK
25
+
26
+ Official Python client for the [KashRock esports API](https://www.kashrock.com).
27
+
28
+ Props, odds, matches, live scores, and history — one key, normalized IDs.
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ pip install kashrock
34
+ ```
35
+
36
+ ## Four lines to a live prop
37
+
38
+ ```python
39
+ from kashrock import KashRock
40
+
41
+ kr = KashRock("YOUR_API_KEY")
42
+ print(kr.props("cs2")["props"][0])
43
+ ```
44
+
45
+ Get a free Sandbox key at [kashrock.com/pricing](https://www.kashrock.com/pricing). Docs: [kashrock.com/docs](https://www.kashrock.com/docs).
46
+
47
+ `KASHROCK_API_KEY` works if you do not want the key in code.
48
+
49
+ ## What you can call
50
+
51
+ ```python
52
+ kr.me()
53
+ kr.props("cs2", book="prizepicks", limit=20)
54
+ kr.lines("cs2")
55
+ kr.matches("cs2", status="upcoming")
56
+ kr.live_games("cs2")
57
+ kr.gamelogs("cs2", "zywoo")
58
+ kr.history_tape(market_key="kr_mk_…")
59
+ ```
60
+
61
+ Same paths as the HTTP API and the [KashRock MCP](https://www.kashrock.com/mcp). Stacks are not included.
62
+
63
+ Sandbox keys are CS2 props only. Hobby+ unlocks the rest of the board. Builder+ unlocks matches, live, gamelogs, and history.
64
+
65
+ ## License
66
+
67
+ MIT
@@ -0,0 +1,44 @@
1
+ # KashRock Python SDK
2
+
3
+ Official Python client for the [KashRock esports API](https://www.kashrock.com).
4
+
5
+ Props, odds, matches, live scores, and history — one key, normalized IDs.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install kashrock
11
+ ```
12
+
13
+ ## Four lines to a live prop
14
+
15
+ ```python
16
+ from kashrock import KashRock
17
+
18
+ kr = KashRock("YOUR_API_KEY")
19
+ print(kr.props("cs2")["props"][0])
20
+ ```
21
+
22
+ Get a free Sandbox key at [kashrock.com/pricing](https://www.kashrock.com/pricing). Docs: [kashrock.com/docs](https://www.kashrock.com/docs).
23
+
24
+ `KASHROCK_API_KEY` works if you do not want the key in code.
25
+
26
+ ## What you can call
27
+
28
+ ```python
29
+ kr.me()
30
+ kr.props("cs2", book="prizepicks", limit=20)
31
+ kr.lines("cs2")
32
+ kr.matches("cs2", status="upcoming")
33
+ kr.live_games("cs2")
34
+ kr.gamelogs("cs2", "zywoo")
35
+ kr.history_tape(market_key="kr_mk_…")
36
+ ```
37
+
38
+ Same paths as the HTTP API and the [KashRock MCP](https://www.kashrock.com/mcp). Stacks are not included.
39
+
40
+ Sandbox keys are CS2 props only. Hobby+ unlocks the rest of the board. Builder+ unlocks matches, live, gamelogs, and history.
41
+
42
+ ## License
43
+
44
+ MIT
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "kashrock"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for the KashRock esports API — props, odds, matches, and scores."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "KashRock", email = "ovitalszn@gmail.com" }]
13
+ keywords = ["esports", "api", "cs2", "valorant", "dota", "props", "odds"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.10",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Topic :: Internet :: WWW/HTTP",
21
+ ]
22
+ dependencies = ["httpx>=0.26,<0.29"]
23
+
24
+ [project.urls]
25
+ Homepage = "https://www.kashrock.com"
26
+ Documentation = "https://www.kashrock.com/docs"
27
+ API = "https://kashrock.up.railway.app"
28
+ Repository = "https://github.com/ovitalszn-cyber/kashrock-python"
29
+
30
+ [tool.setuptools.packages.find]
31
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,15 @@
1
+ from kashrock.client import KashRock
2
+ from kashrock.errors import (
3
+ KashRockAuthError,
4
+ KashRockError,
5
+ KashRockPlanError,
6
+ KashRockRateLimitError,
7
+ )
8
+
9
+ __all__ = [
10
+ "KashRock",
11
+ "KashRockAuthError",
12
+ "KashRockError",
13
+ "KashRockPlanError",
14
+ "KashRockRateLimitError",
15
+ ]
@@ -0,0 +1,75 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from typing import Any, Mapping, Optional
5
+ from urllib.parse import urlencode
6
+
7
+ import httpx
8
+
9
+ from kashrock.errors import (
10
+ KashRockAuthError,
11
+ KashRockError,
12
+ KashRockPlanError,
13
+ KashRockRateLimitError,
14
+ )
15
+
16
+ DEFAULT_BASE = "https://kashrock.up.railway.app"
17
+
18
+
19
+ def _detail(body: Any) -> str:
20
+ if isinstance(body, dict):
21
+ detail = body.get("detail")
22
+ if isinstance(detail, str):
23
+ return detail
24
+ if detail is not None:
25
+ return json.dumps(detail)
26
+ if isinstance(body, str):
27
+ return body
28
+ return json.dumps(body)
29
+
30
+
31
+ def raise_for_status(status: int, body: Any) -> None:
32
+ text = _detail(body)
33
+ if status in (401, 403) and "plan" in text.lower():
34
+ raise KashRockPlanError(text, status=status, body=body)
35
+ if status in (401, 403):
36
+ raise KashRockAuthError(text, status=status, body=body)
37
+ if status == 429:
38
+ raise KashRockRateLimitError(text, status=status, body=body)
39
+ raise KashRockError(text, status=status, body=body)
40
+
41
+
42
+ def clean_params(params: Optional[Mapping[str, Any]]) -> dict[str, Any]:
43
+ out: dict[str, Any] = {}
44
+ for key, value in (params or {}).items():
45
+ if value is None or value == "":
46
+ continue
47
+ if isinstance(value, bool):
48
+ out[key] = "true" if value else "false"
49
+ else:
50
+ out[key] = value
51
+ return out
52
+
53
+
54
+ class Http:
55
+ def __init__(self, api_key: str, *, base_url: str = DEFAULT_BASE, timeout: float = 60.0) -> None:
56
+ self.api_key = api_key
57
+ self.base_url = base_url.rstrip("/")
58
+ self.timeout = timeout
59
+
60
+ def get(self, path: str, params: Optional[Mapping[str, Any]] = None) -> Any:
61
+ query = clean_params(params)
62
+ suffix = f"?{urlencode(query)}" if query else ""
63
+ url = f"{self.base_url}{path}{suffix}"
64
+ response = httpx.get(
65
+ url,
66
+ headers={"X-API-Key": self.api_key},
67
+ timeout=self.timeout,
68
+ )
69
+ try:
70
+ body = response.json()
71
+ except json.JSONDecodeError:
72
+ body = {"detail": response.text[:500]}
73
+ if response.status_code >= 400:
74
+ raise_for_status(response.status_code, body)
75
+ return body
@@ -0,0 +1,135 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from typing import Any, Optional
5
+
6
+ from kashrock._http import DEFAULT_BASE, Http
7
+ from kashrock.errors import KashRockAuthError
8
+
9
+
10
+ class KashRock:
11
+ """Thin client for https://kashrock.up.railway.app."""
12
+
13
+ def __init__(
14
+ self,
15
+ api_key: Optional[str] = None,
16
+ *,
17
+ base_url: str = DEFAULT_BASE,
18
+ timeout: float = 60.0,
19
+ ) -> None:
20
+ key = api_key or os.environ.get("KASHROCK_API_KEY", "")
21
+ if not key:
22
+ raise KashRockAuthError(
23
+ "Pass an API key or set KASHROCK_API_KEY. Get one at https://www.kashrock.com/pricing",
24
+ status=401,
25
+ )
26
+ self._http = Http(key, base_url=base_url, timeout=timeout)
27
+
28
+ def _get(self, path: str, **params: Any) -> Any:
29
+ return self._http.get(path, params)
30
+
31
+ def _sport(self, sport: str, suffix: str, **params: Any) -> Any:
32
+ return self._get(f"/v6/esports/{sport}/{suffix}", **params)
33
+
34
+ def me(self) -> Any:
35
+ return self._get("/v6/me")
36
+
37
+ def books(self) -> Any:
38
+ return self._get("/v6/books")
39
+
40
+ def props(self, sport: str, **params: Any) -> Any:
41
+ return self._sport(sport, "props", **params)
42
+
43
+ def player_props(self, sport: str, **params: Any) -> Any:
44
+ return self._sport(sport, "player-props", **params)
45
+
46
+ def media(self, sport: str, **params: Any) -> Any:
47
+ return self._sport(sport, "media", **params)
48
+
49
+ def lines(self, sport: str, **params: Any) -> Any:
50
+ return self._sport(sport, "lines", **params)
51
+
52
+ def gaps(self, sport: str, **params: Any) -> Any:
53
+ return self._sport(sport, "gaps", **params)
54
+
55
+ def coverage(self, sport: str, **params: Any) -> Any:
56
+ params.setdefault("include_props", False)
57
+ return self.props(sport, **params)
58
+
59
+ def rankings(self, sport: str, **params: Any) -> Any:
60
+ return self._sport(sport, "rankings", **params)
61
+
62
+ def search_players(self, sport: str, q: str, **params: Any) -> Any:
63
+ return self._sport(sport, "players/search", q=q, **params)
64
+
65
+ def player(self, sport: str, player_id: str, **params: Any) -> Any:
66
+ return self._sport(sport, f"players/{player_id}", **params)
67
+
68
+ def player_stats(self, sport: str, player_id: str, **params: Any) -> Any:
69
+ return self._sport(sport, f"players/{player_id}/stats", **params)
70
+
71
+ def player_stats_full(self, sport: str, player_id: str, **params: Any) -> Any:
72
+ return self._sport(sport, f"players/{player_id}/stats/full", **params)
73
+
74
+ def gamelogs(self, sport: str, player: str, **params: Any) -> Any:
75
+ return self._sport(sport, f"players/{player}/gamelogs", **params)
76
+
77
+ def matches(self, sport: str, **params: Any) -> Any:
78
+ return self._sport(sport, "matches", **params)
79
+
80
+ def match(self, sport: str, kr_match_id: str, **params: Any) -> Any:
81
+ return self._sport(sport, f"matches/id/{kr_match_id}", **params)
82
+
83
+ def search_matches(self, sport: str, **params: Any) -> Any:
84
+ return self._sport(sport, "matches/search", **params)
85
+
86
+ def team_matches(self, sport: str, team: str, **params: Any) -> Any:
87
+ return self._sport(sport, f"teams/{team}/matches", **params)
88
+
89
+ def streams(self, sport: str, **params: Any) -> Any:
90
+ return self._sport(sport, "streams", **params)
91
+
92
+ def live_games(self, sport: str, **params: Any) -> Any:
93
+ return self._sport(sport, "live/games", **params)
94
+
95
+ def live_boxscore(self, sport: str, game_id: str, **params: Any) -> Any:
96
+ return self._sport(sport, f"live/{game_id}/boxscore", **params)
97
+
98
+ def live_frames(self, sport: str, game_id: str, **params: Any) -> Any:
99
+ return self._sport(sport, f"live/{game_id}/frames", **params)
100
+
101
+ def live_events(self, sport: str, game_id: str, **params: Any) -> Any:
102
+ return self._sport(sport, f"live/{game_id}/events", **params)
103
+
104
+ def boxscore(self, sport: str, match_slug: str, **params: Any) -> Any:
105
+ return self._sport(sport, f"matches/{match_slug}/boxscore", **params)
106
+
107
+ def boxscores(self, sport: str, **params: Any) -> Any:
108
+ return self._sport(sport, "boxscores", **params)
109
+
110
+ def results(self, sport: str, **params: Any) -> Any:
111
+ return self._sport(sport, "results", **params)
112
+
113
+ def history_tape(self, **params: Any) -> Any:
114
+ return self._get("/v6/esports/history/contract", **params)
115
+
116
+ def team_h2h(self, sport: str, **params: Any) -> Any:
117
+ return self._sport(sport, "teams/h2h", **params)
118
+
119
+ def research_board(self, **params: Any) -> Any:
120
+ return self._get("/v6/esports/research/board", **params)
121
+
122
+ def research_board_tapes(self, **params: Any) -> Any:
123
+ return self._get("/v6/esports/research/board-tapes", **params)
124
+
125
+ def research_player(self, **params: Any) -> Any:
126
+ return self._get("/v6/esports/research/player", **params)
127
+
128
+ def match_prep(self, match_slug: str, sport: str = "cs2", **params: Any) -> Any:
129
+ return self._sport(sport, f"matches/{match_slug}/prep", **params)
130
+
131
+ def player_board(self, match_slug: str, sport: str = "cs2", **params: Any) -> Any:
132
+ return self._sport(sport, f"matches/{match_slug}/player-board", **params)
133
+
134
+ def tournament_maps(self, match_slug: str, sport: str = "cs2", **params: Any) -> Any:
135
+ return self._sport(sport, f"matches/{match_slug}/tournament-maps", **params)
@@ -0,0 +1,38 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, Optional
4
+
5
+
6
+ class KashRockError(Exception):
7
+ def __init__(
8
+ self,
9
+ message: str,
10
+ *,
11
+ status: Optional[int] = None,
12
+ body: Any = None,
13
+ ) -> None:
14
+ super().__init__(message)
15
+ self.message = message
16
+ self.status = status
17
+ self.body = body
18
+
19
+
20
+ class KashRockAuthError(KashRockError):
21
+ pass
22
+
23
+
24
+ class KashRockPlanError(KashRockError):
25
+ def __init__(
26
+ self,
27
+ message: str,
28
+ *,
29
+ status: Optional[int] = None,
30
+ body: Any = None,
31
+ upgrade_url: str = "https://www.kashrock.com/pricing",
32
+ ) -> None:
33
+ super().__init__(message, status=status, body=body)
34
+ self.upgrade_url = upgrade_url
35
+
36
+
37
+ class KashRockRateLimitError(KashRockError):
38
+ pass
File without changes
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: kashrock
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the KashRock esports API — props, odds, matches, and scores.
5
+ Author-email: KashRock <ovitalszn@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://www.kashrock.com
8
+ Project-URL: Documentation, https://www.kashrock.com/docs
9
+ Project-URL: API, https://kashrock.up.railway.app
10
+ Project-URL: Repository, https://github.com/ovitalszn-cyber/kashrock-python
11
+ Keywords: esports,api,cs2,valorant,dota,props,odds
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Internet :: WWW/HTTP
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: httpx<0.29,>=0.26
22
+ Dynamic: license-file
23
+
24
+ # KashRock Python SDK
25
+
26
+ Official Python client for the [KashRock esports API](https://www.kashrock.com).
27
+
28
+ Props, odds, matches, live scores, and history — one key, normalized IDs.
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ pip install kashrock
34
+ ```
35
+
36
+ ## Four lines to a live prop
37
+
38
+ ```python
39
+ from kashrock import KashRock
40
+
41
+ kr = KashRock("YOUR_API_KEY")
42
+ print(kr.props("cs2")["props"][0])
43
+ ```
44
+
45
+ Get a free Sandbox key at [kashrock.com/pricing](https://www.kashrock.com/pricing). Docs: [kashrock.com/docs](https://www.kashrock.com/docs).
46
+
47
+ `KASHROCK_API_KEY` works if you do not want the key in code.
48
+
49
+ ## What you can call
50
+
51
+ ```python
52
+ kr.me()
53
+ kr.props("cs2", book="prizepicks", limit=20)
54
+ kr.lines("cs2")
55
+ kr.matches("cs2", status="upcoming")
56
+ kr.live_games("cs2")
57
+ kr.gamelogs("cs2", "zywoo")
58
+ kr.history_tape(market_key="kr_mk_…")
59
+ ```
60
+
61
+ Same paths as the HTTP API and the [KashRock MCP](https://www.kashrock.com/mcp). Stacks are not included.
62
+
63
+ Sandbox keys are CS2 props only. Hobby+ unlocks the rest of the board. Builder+ unlocks matches, live, gamelogs, and history.
64
+
65
+ ## License
66
+
67
+ MIT
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/kashrock/__init__.py
5
+ src/kashrock/_http.py
6
+ src/kashrock/client.py
7
+ src/kashrock/errors.py
8
+ src/kashrock/py.typed
9
+ src/kashrock.egg-info/PKG-INFO
10
+ src/kashrock.egg-info/SOURCES.txt
11
+ src/kashrock.egg-info/dependency_links.txt
12
+ src/kashrock.egg-info/requires.txt
13
+ src/kashrock.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ httpx<0.29,>=0.26
@@ -0,0 +1 @@
1
+ kashrock