Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 13 additions & 29 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: pypi

name: Publish to PyPI
on:
release:
types: [published]

permissions:
contents: read
jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
python-version: "3.14"
- run: uv build
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
password: ${{ secrets.PYPI_API_TOKEN }}
68 changes: 24 additions & 44 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,31 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: test

on: [push, pull_request]

name: CI
on:
push:
branches: [master]
pull_request:
permissions:
contents: read
jobs:
testing:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
python: ["3.10", "3.14"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
persist-credentials: false
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
python-version: ${{ matrix.python }}
- run: uv sync --locked
- run: uv run ruff check espncricinfo tests scripts
- run: uv run ruff format --check espncricinfo tests scripts
- run: uv run pytest -q
- name: Test installed wheel
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install nose coverage

- name: Run nose tests
run: nosetests -s
yamllint:
name: Yaml Linting
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install yamllint
- name: Run yamllint
run: yamllint */
uv build
uv venv /tmp/wheel-test
uv pip install --python /tmp/wheel-test/bin/python dist/*.whl pytest
cd /tmp
/tmp/wheel-test/bin/python -m pytest --import-mode=importlib "$GITHUB_WORKSPACE/tests" -q
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ __pycache__/
build/
dist/
.eggs/
uv.lock
Pipfile
Pipfile.lock
*.egg
comms.json
matches.csv
matches.json
fixes.py

.venv/
.pytest_cache/
.ruff_cache/
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include pytest.ini
recursive-include tests *.py *.json *.html
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# python-espncricinfo

A Python 3 client for ESPNCricinfo's match, summary and player information.
A Python 3.10+ client for ESPNCricinfo's match, summary and player information.

### Description

A Python 3 client for ESPNCricinfo match, series and player data. The library uses Playwright (WebKit) to fetch match pages and extract embedded JSON, bypassing Akamai CDN restrictions on the legacy engine API endpoints. Both a `match_id` and `series_id` are required to instantiate a `Match` — both can be obtained from `Match.get_recent_matches()`. See the Usage section for instructions, and see `match.py` for individual functions.
A Python 3.10+ client for ESPNCricinfo match, series and player data. The library uses Playwright (WebKit) to fetch match pages and extract embedded JSON, bypassing Akamai CDN restrictions on the legacy engine API endpoints. Both a `match_id` and `series_id` are required to instantiate a `Match` — both can be obtained from `Match.get_recent_matches()`. See the Usage section for instructions, and see `match.py` for individual functions.

Disclaimer: This library is not intended for commercial use and neither it nor its creator has any affiliation with ESPNCricInfo. The [LICENSE](LICENSE.txt) for this library applies only to the code, not to the data.

Expand Down
8 changes: 7 additions & 1 deletion espncricinfo/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ class MatchNotFoundError(TypeError):
"""
Exception raised if a match_id is not valid or does not exist.
"""

pass


class PlayerNotFoundError(TypeError):
pass


class NoScorecardError(TypeError):
"""
Exception raised if a match has no scorecard
"""

pass


class NoSeriesError(TypeError):
"""
Exception raised if a series_id is not valid or does not exist.
"""
pass

pass
Loading
Loading