Skip to main content

BALLDONTLIE API

Official Python SDK for the BALLDONTLIE API. Access NBA, NFL, and MLB statistics and data. Check out the official website here.

Installation

# Install the latest version
pip install balldontlie

# Install a specific version
pip install balldontlie==0.1.0

Usage

from balldontlie import BalldontlieAPI

api = BalldontlieAPI(api_key="your-api-key")

# NBA (see documentation for full list of methods)
api.nba.teams.list()

# MLB
api.mlb.teams.list()

# NFL
api.nfl.teams.list()

API Reference

Check out the full API documentation: NBA NFL MLB

Error Handling

from balldontlie import BalldontlieAPI
from balldontlie.exceptions import (
    AuthenticationError,
    RateLimitError,
    ValidationError,
    NotFoundError,
    ServerError,
    BallDontLieException
)

client = BalldontlieAPI(api_key="your_key")

try:
    teams = client.nba.teams.list()
except AuthenticationError as e:
    print(f"Invalid API key. Status: {e.status_code}, Details: {e.response_data}")
except RateLimitError as e:
    print(f"Rate limit exceeded. Status: {e.status_code}, Details: {e.response_data}")
except ValidationError as e:
    print(f"Invalid request parameters. Status: {e.status_code}, Details: {e.response_data}")
except NotFoundError as e:
    print(f"Resource not found. Status: {e.status_code}, Details: {e.response_data}")
except ServerError as e:
    print(f"API server error. Status: {e.status_code}, Details: {e.response_data}")
except BallDontLieException as e:
    print(f"General API error. Status: {e.status_code}, Details: {e.response_data}")
except Exception as e:
    print(f"Unexpected error: {str(e)}")

Metadata

Release files for balldontlie 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for balldontlie 0.1.6
File Size Uploaded Provenance
balldontlie-0.1.6.tar.gz 10.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 24.3 kB

Release files / balldontlie-0.1.6.tar.gz

Download URL balldontlie-0.1.6.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
739ea4ba6e245b7a0289ff962ceb9124db4de26916e9ca7a9c37ad8606c1e522
BLAKE2b-256 checksum
How to use checksums
4bdf2de2cb383b7e25d086ea6226b922dd2baf66cc918b81f81606681ca03652
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.6

Release files / balldontlie-0.1.6-py3-none-any.whl

Download URL balldontlie-0.1.6-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3baa021bd6346fe129f674a5fedd9e5e2bc0a1dcfd1b3a3291934068959e27a2
BLAKE2b-256 checksum
How to use checksums
9d35aba11fff14a5dcad529ee213e34ac11ba6dcc4cc99eb2d5cee2ac4e7023c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.6

Security for balldontlie 0.1.6

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.

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