python-espncricinfo 1.0.0__py3-none-any.whl

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.
@@ -0,0 +1,166 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-espncricinfo
3
+ Version: 1.0.0
4
+ Summary: Python client for ESPNcricinfo match, series, season, team and player data
5
+ Keywords: espncricinfo,cricket,t20,odi,test cricket,scorecard,sports data
6
+ Author: Derek Willis
7
+ Author-email: Derek Willis <dwillis@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE.txt
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Internet :: WWW/HTTP
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Dist: requests
22
+ Requires-Dist: beautifulsoup4
23
+ Requires-Dist: dateparser
24
+ Requires-Dist: lxml
25
+ Requires-Dist: playwright>=1.48.0
26
+ Requires-Python: >=3.12
27
+ Project-URL: Homepage, https://github.com/outside-edge/python-espncricinfo
28
+ Project-URL: Repository, https://github.com/outside-edge/python-espncricinfo
29
+ Project-URL: Documentation, https://outside-edge.github.io/python-espncricinfo/
30
+ Project-URL: Changelog, https://github.com/outside-edge/python-espncricinfo/blob/master/CHANGELOG.md
31
+ Project-URL: Issues, https://github.com/outside-edge/python-espncricinfo/issues
32
+ Description-Content-Type: text/markdown
33
+
34
+ # python-espncricinfo
35
+
36
+ [![PyPI](https://img.shields.io/pypi/v/python-espncricinfo)](https://pypi.org/project/python-espncricinfo/)
37
+ [![Downloads](https://static.pepy.tech/badge/python-espncricinfo)](https://pepy.tech/projects/python-espncricinfo)
38
+ [![CI](https://github.com/outside-edge/python-espncricinfo/actions/workflows/ci.yml/badge.svg)](https://github.com/outside-edge/python-espncricinfo/actions/workflows/ci.yml)
39
+ [![Docs](https://github.com/outside-edge/python-espncricinfo/actions/workflows/docs.yml/badge.svg)](https://outside-edge.github.io/python-espncricinfo/)
40
+ [![Python](https://img.shields.io/pypi/pyversions/python-espncricinfo)](https://pypi.org/project/python-espncricinfo/)
41
+
42
+ <!-- SPHINX-START -->
43
+
44
+ A Python client for ESPNcricinfo match, series, season, team and player data.
45
+
46
+ ## Description
47
+
48
+ Match pages are loaded with Playwright (WebKit), because ESPN's CDN refuses plain HTTP clients; player, series, season and team records come from ESPN's core JSON API. A `Match` needs both a `match_id` and a `series_id`, which `Match.get_recent_matches()` and `Series(...).matches` provide.
49
+
50
+ Disclaimer: This library is not intended for commercial use and neither it nor its creator has any affiliation with ESPNCricInfo. The [LICENSE](https://github.com/outside-edge/python-espncricinfo/blob/master/LICENSE.txt) for this library applies only to the code, not to the data.
51
+
52
+ ## Installation
53
+
54
+ ```shell
55
+ uv add python-espncricinfo
56
+ ```
57
+
58
+ Or with pip:
59
+
60
+ ```shell
61
+ pip install python-espncricinfo
62
+ ```
63
+
64
+ After installation, install the Playwright WebKit browser (required for fetching match data):
65
+
66
+ ```shell
67
+ uv run playwright install webkit
68
+ ```
69
+
70
+ <!-- USAGE-START -->
71
+
72
+ ## Recent matches
73
+
74
+ `Summary().matches` lists the matches on ESPNcricinfo's results page. Pass a date to look back; ESPN returns about two weeks of matches ending on that day.
75
+
76
+ ```python
77
+ >>> from espncricinfo.match import Match
78
+ >>> refs = Match.get_recent_matches(date="2026-02-28")
79
+ >>> len(refs)
80
+ 195
81
+ >>> refs[0]
82
+ MatchRef(series_id=1523975, match_id=1523981)
83
+ >>> series_id, match_id = refs[0] # MatchRefs unpack like tuples
84
+ ```
85
+
86
+ `Summary(date=...)` wraps the same call; its result is in `.matches`.
87
+
88
+ ## A single match
89
+
90
+ A match needs both its match ID and series ID: the two numbers in a match page URL, or a `MatchRef`. Loading a match starts a headless WebKit browser.
91
+
92
+ ```python
93
+ >>> m = Match(1478914, 1478874) # same as MatchRef(1478874, 1478914).to_match()
94
+ >>> m.description
95
+ 'IND Women v AUS Women'
96
+ >>> m.match_class
97
+ 'WT20I'
98
+ >>> m.result
99
+ 'IND Women won by 17 runs'
100
+ >>> m.batting_scorecard[0][0]["name"], m.batting_scorecard[0][0]["runs"]
101
+ ('S Mandhana', 82)
102
+ >>> m.bowling_scorecard[0][0]["name"], m.bowling_scorecard[0][0]["wickets"]
103
+ ('D Brown', 0)
104
+ ```
105
+
106
+ `batting_scorecard` and `bowling_scorecard` hold one list per innings and one dict per player.
107
+
108
+ ## Players
109
+
110
+ The player ID is the number at the end of a player's profile URL.
111
+
112
+ ```python
113
+ >>> from espncricinfo.player import Player
114
+ >>> p = Player(277916)
115
+ >>> p.full_name
116
+ 'Ajinkya Madhukar Rahane'
117
+ >>> p.get_data(file_name="rahane_tests.csv", match_format=1, data_type="batting")
118
+ ```
119
+
120
+ `get_data` writes one row per match (85 Tests for Rahane); `get_career_summary` and `get_career_averages` write the summary tables from the same Statsguru page.
121
+
122
+ ## Series, seasons and teams
123
+
124
+ ```python
125
+ >>> from espncricinfo.series import Series
126
+ >>> ipl = Series(1449924)
127
+ >>> ipl.name
128
+ 'Indian Premier League'
129
+ >>> season = ipl.current_season
130
+ >>> season.year, len(season.teams)
131
+ (2025, 10)
132
+ >>> season.teams[0].name
133
+ 'Chennai Super Kings'
134
+ ```
135
+
136
+ `series.season_objects` lists every season and `season.match_refs` that season's matches. `series.matches` collects MatchRefs across all seasons (1,254 for the IPL), and `series.current_matches` keeps those in progress. `team.players` loads the squad on demand. ESPN's records for some bilateral tours are incomplete, for example listing one team for a two-team series.
137
+
138
+ <!-- USAGE-END -->
139
+
140
+ ## Development
141
+
142
+ <!-- DEV-START -->
143
+
144
+ **Unit tests** (no network required — uses recorded fixtures):
145
+
146
+ ```shell
147
+ uv run pytest
148
+ ```
149
+
150
+ **Integration tests** (hits live ESPN Cricinfo via Playwright):
151
+
152
+ ```shell
153
+ uv run pytest --live
154
+ ```
155
+
156
+ **Refreshing fixtures** (re-records fixtures from live site):
157
+
158
+ ```shell
159
+ uv run python scripts/refresh_fixtures.py
160
+ ```
161
+
162
+ Integration tests and the fixture refresh need the WebKit browser:
163
+
164
+ ```shell
165
+ uv run playwright install webkit
166
+ ```
@@ -0,0 +1,15 @@
1
+ espncricinfo/__init__.py,sha256=VcTY_Xq-aWgJETFMVT8MrK6EZ-9bgNU-M-9plQ-PZGE,82
2
+ espncricinfo/_core.py,sha256=878hPyisByhxc6EcUzM6LYo3mWj68ITnqitVMpu4zrU,2047
3
+ espncricinfo/exceptions.py,sha256=BVYeK5RaeCCA0XeL-e5wpgEVpUWiX-HL5LNSUlvy9jU,629
4
+ espncricinfo/match.py,sha256=Rgn_bP5IIyOqLadPSZQkKurS_5xq1uOCtOAjSqdQab8,25610
5
+ espncricinfo/match_ref.py,sha256=gRl3w8DPMiu2R3mI5Avqn7--KpbsTx4jRmQCEK1QiyU,2836
6
+ espncricinfo/player.py,sha256=muQC72oiNoygSaMV0mO6vyMfc-An71ANGl6qdoZcB4E,6642
7
+ espncricinfo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ espncricinfo/seasons.py,sha256=LiUzEhwrbOHZyy31zYv4AROccFbmUQL8ZpCCJqIkdIY,3215
9
+ espncricinfo/series.py,sha256=GK7nE2tgGROSYf5HBqTkwNfQcjSVcUvtuw7o_cVM45U,4643
10
+ espncricinfo/summary.py,sha256=OYQrTnIo00TUJzkI3W2-ZFjeWXuDhchUJNDetJOuwDg,997
11
+ espncricinfo/teams.py,sha256=uGIHn1hybVmVGKltfzu4E_87FXETXnluPAYLHkoB08Q,3524
12
+ python_espncricinfo-1.0.0.dist-info/licenses/LICENSE.txt,sha256=AvXJGulG8VBGlLUxRDk6UICI-wmIaQNz-dYHhxQE5yU,1069
13
+ python_espncricinfo-1.0.0.dist-info/WHEEL,sha256=si2p8vW03RnhyBnhWl4tj-ObJa78SpE-c9HsEtblGR0,80
14
+ python_espncricinfo-1.0.0.dist-info/METADATA,sha256=v-wTXusNwVS1AbDHekf9XMagJn2YWBYR7jCLlhpMBV8,5904
15
+ python_espncricinfo-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.13.5
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Derek Willis
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.