# cwendt94/espn-api architecture

> Architecture diagram of the GitHub repository cwendt94/espn-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cwendt94/espn-api
- Repository: https://github.com/cwendt94/espn-api

## Overview

espn_api is a Python client for retrieving and modeling ESPN fantasy-league data across football, basketball, hockey, baseball, and women’s basketball. The main workflow is to create a sport-specific League for a league ID and season; the league coordinates ESPN requests and assembles league, team, roster, matchup, and player objects, which callers use to inspect results. The graph includes documented sport-specific capabilities and shared request/transaction layers. Several relationships come from the SOURCE INDEX import/reference map; unsampled internals are not inferred beyond those references.

Main entry points: [`espn_api/base_league.py`](https://github.com/cwendt94/espn-api/blob/master/espn_api/base_league.py) (Shared league), [`espn_api/football/league.py`](https://github.com/cwendt94/espn-api/blob/master/espn_api/football/league.py) (Football league), [`espn_api/basketball/league.py`](https://github.com/cwendt94/espn-api/blob/master/espn_api/basketball/league.py) (Basketball league), [`espn_api/baseball/league.py`](https://github.com/cwendt94/espn-api/blob/master/espn_api/baseball/league.py) (Baseball league)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_league["League Core"]
  node_base_league["Shared league<br/>[base_league.py]"]
  node_settings["League settings<br/>[base_settings.py]"]
  node_draft_pick["Draft picks<br/>[base_pick.py]"]
  node_offer["Auction offers<br/>[base_offer.py]"]
  node_trade_fill["Trade enrichment<br/>[trade_fill.py]"]
  node_logger["Request logging<br/>[logger.py]"]
end

subgraph group_transport["ESPN Transport"]
  node_requests["ESPN requests<br/>[espn_requests.py]"]
end

subgraph group_football["Football"]
  node_football_league["Football league<br/>[league.py]"]
  node_football_player["Football player<br/>[player.py]"]
  node_football_txn["Football transactions<br/>[transaction.py]"]
  node_football_matchup["Football matchups<br/>[matchup.py]"]
end

subgraph group_basketball["Basketball"]
  node_basketball_league["Basketball league<br/>[league.py]"]
  node_basketball_player["Basketball player<br/>[player.py]"]
  node_basketball_txn["Basketball transactions<br/>[transaction.py]"]
  node_basketball_matchup["Basketball matchups<br/>[matchup.py]"]
end

subgraph group_hockey["Hockey"]
  node_hockey_league["Hockey league<br/>[league.py]"]
  node_hockey_player["Hockey player<br/>[player.py]"]
  node_hockey_matchup["Hockey matchups<br/>[matchup.py]"]
end

subgraph group_baseball["Baseball &amp; WNBA"]
  node_baseball_league["Baseball league<br/>[league.py]"]
  node_baseball_player["Baseball player<br/>[player.py]"]
  node_baseball_txn["Baseball transactions<br/>[transaction.py]"]
  node_baseball_matchup["Baseball matchups<br/>[matchup.py]"]
  node_wbasketball_league["WNBA league<br/>[league.py]"]
  node_wbasketball_player["WNBA player<br/>[player.py]"]
  node_wbasketball_matchup["WNBA matchups<br/>[matchup.py]"]
end

node_caller(("API caller"))
node_espn["ESPN Fantasy API"]

node_caller -->|"creates league"| node_football_league
node_caller -->|"creates league"| node_basketball_league
node_caller -->|"creates league"| node_hockey_league
node_caller -->|"creates league"| node_baseball_league
node_football_league -->|"inherits from"| node_base_league
node_basketball_league -->|"inherits from"| node_base_league
node_hockey_league -->|"inherits from"| node_base_league
node_baseball_league -->|"inherits from"| node_base_league
node_wbasketball_league -->|"inherits from"| node_base_league
node_base_league -->|"fetches league data"| node_requests
node_requests -->|"sends HTTP requests"| node_espn
node_requests -->|"logs responses"| node_logger
node_base_league -->|"builds settings"| node_settings
node_base_league -->|"builds picks"| node_draft_pick
node_base_league -->|"uses trade filling"| node_trade_fill
node_football_league -->|"uses players"| node_football_player
node_football_league -->|"uses matchups"| node_football_matchup
node_football_league -->|"builds transactions"| node_football_txn
node_football_league -->|"uses offers"| node_offer
node_football_player -->|"parses transactions"| node_trade_fill
node_basketball_league -->|"uses players"| node_basketball_player
node_basketball_league -->|"uses matchups"| node_basketball_matchup
node_basketball_league -->|"builds transactions"| node_basketball_txn
node_basketball_player -->|"parses transactions"| node_trade_fill
node_hockey_league -->|"uses players"| node_hockey_player
node_hockey_league -->|"uses matchups"| node_hockey_matchup
node_baseball_league -->|"uses players"| node_baseball_player
node_baseball_league -->|"uses matchups"| node_baseball_matchup
node_baseball_league -->|"builds transactions"| node_baseball_txn
node_baseball_player -->|"parses transactions"| node_trade_fill
node_wbasketball_league -->|"uses players"| node_wbasketball_player
node_wbasketball_league -->|"uses matchups"| node_wbasketball_matchup

click node_base_league "https://github.com/cwendt94/espn-api/blob/master/espn_api/base_league.py"
click node_settings "https://github.com/cwendt94/espn-api/blob/master/espn_api/base_settings.py"
click node_draft_pick "https://github.com/cwendt94/espn-api/blob/master/espn_api/base_pick.py"
click node_offer "https://github.com/cwendt94/espn-api/blob/master/espn_api/base_offer.py"
click node_trade_fill "https://github.com/cwendt94/espn-api/blob/master/espn_api/utils/trade_fill.py"
click node_logger "https://github.com/cwendt94/espn-api/blob/master/espn_api/utils/logger.py"
click node_requests "https://github.com/cwendt94/espn-api/blob/master/espn_api/requests/espn_requests.py"
click node_football_league "https://github.com/cwendt94/espn-api/blob/master/espn_api/football/league.py"
click node_football_player "https://github.com/cwendt94/espn-api/blob/master/espn_api/football/player.py"
click node_football_txn "https://github.com/cwendt94/espn-api/blob/master/espn_api/football/transaction.py"
click node_football_matchup "https://github.com/cwendt94/espn-api/blob/master/espn_api/football/matchup.py"
click node_basketball_league "https://github.com/cwendt94/espn-api/blob/master/espn_api/basketball/league.py"
click node_basketball_player "https://github.com/cwendt94/espn-api/blob/master/espn_api/basketball/player.py"
click node_basketball_txn "https://github.com/cwendt94/espn-api/blob/master/espn_api/basketball/transaction.py"
click node_basketball_matchup "https://github.com/cwendt94/espn-api/blob/master/espn_api/basketball/matchup.py"
click node_hockey_league "https://github.com/cwendt94/espn-api/blob/master/espn_api/hockey/league.py"
click node_hockey_player "https://github.com/cwendt94/espn-api/blob/master/espn_api/hockey/player.py"
click node_hockey_matchup "https://github.com/cwendt94/espn-api/blob/master/espn_api/hockey/matchup.py"
click node_baseball_league "https://github.com/cwendt94/espn-api/blob/master/espn_api/baseball/league.py"
click node_baseball_player "https://github.com/cwendt94/espn-api/blob/master/espn_api/baseball/player.py"
click node_baseball_txn "https://github.com/cwendt94/espn-api/blob/master/espn_api/baseball/transaction.py"
click node_baseball_matchup "https://github.com/cwendt94/espn-api/blob/master/espn_api/baseball/matchup.py"
click node_wbasketball_league "https://github.com/cwendt94/espn-api/blob/master/espn_api/wbasketball/league.py"
click node_wbasketball_player "https://github.com/cwendt94/espn-api/blob/master/espn_api/wbasketball/player.py"
click node_wbasketball_matchup "https://github.com/cwendt94/espn-api/blob/master/espn_api/wbasketball/matchup.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_base_league,node_settings,node_draft_pick,node_offer,node_trade_fill,node_logger toneBlue
class node_requests toneAmber
class node_football_league,node_football_player,node_football_txn,node_football_matchup,node_caller,node_espn toneMint
class node_basketball_league,node_basketball_player,node_basketball_txn,node_basketball_matchup toneRose
class node_hockey_league,node_hockey_player,node_hockey_matchup toneIndigo
class node_baseball_league,node_baseball_player,node_baseball_txn,node_baseball_matchup,node_wbasketball_league,node_wbasketball_player,node_wbasketball_matchup toneTeal
```

## Components

### League Core

- [Shared league](https://github.com/cwendt94/espn-api/blob/master/espn_api/base_league.py): `espn_api/base_league.py`
- [League settings](https://github.com/cwendt94/espn-api/blob/master/espn_api/base_settings.py): `espn_api/base_settings.py`
- [Draft picks](https://github.com/cwendt94/espn-api/blob/master/espn_api/base_pick.py): `espn_api/base_pick.py`
- [Auction offers](https://github.com/cwendt94/espn-api/blob/master/espn_api/base_offer.py): `espn_api/base_offer.py`
- [Trade enrichment](https://github.com/cwendt94/espn-api/blob/master/espn_api/utils/trade_fill.py): `espn_api/utils/trade_fill.py`
- [Request logging](https://github.com/cwendt94/espn-api/blob/master/espn_api/utils/logger.py): `espn_api/utils/logger.py`

### ESPN Transport

- [ESPN requests](https://github.com/cwendt94/espn-api/blob/master/espn_api/requests/espn_requests.py): `espn_api/requests/espn_requests.py`

### Football

- [Football league](https://github.com/cwendt94/espn-api/blob/master/espn_api/football/league.py): `espn_api/football/league.py`
- [Football player](https://github.com/cwendt94/espn-api/blob/master/espn_api/football/player.py): `espn_api/football/player.py`
- [Football transactions](https://github.com/cwendt94/espn-api/blob/master/espn_api/football/transaction.py): `espn_api/football/transaction.py`
- [Football matchups](https://github.com/cwendt94/espn-api/blob/master/espn_api/football/matchup.py): `espn_api/football/matchup.py`

### Basketball

- [Basketball league](https://github.com/cwendt94/espn-api/blob/master/espn_api/basketball/league.py): `espn_api/basketball/league.py`
- [Basketball player](https://github.com/cwendt94/espn-api/blob/master/espn_api/basketball/player.py): `espn_api/basketball/player.py`
- [Basketball transactions](https://github.com/cwendt94/espn-api/blob/master/espn_api/basketball/transaction.py): `espn_api/basketball/transaction.py`
- [Basketball matchups](https://github.com/cwendt94/espn-api/blob/master/espn_api/basketball/matchup.py): `espn_api/basketball/matchup.py`

### Hockey

- [Hockey league](https://github.com/cwendt94/espn-api/blob/master/espn_api/hockey/league.py): `espn_api/hockey/league.py`
- [Hockey player](https://github.com/cwendt94/espn-api/blob/master/espn_api/hockey/player.py): `espn_api/hockey/player.py`
- [Hockey matchups](https://github.com/cwendt94/espn-api/blob/master/espn_api/hockey/matchup.py): `espn_api/hockey/matchup.py`

### Baseball & WNBA

- [Baseball league](https://github.com/cwendt94/espn-api/blob/master/espn_api/baseball/league.py): `espn_api/baseball/league.py`
- [Baseball player](https://github.com/cwendt94/espn-api/blob/master/espn_api/baseball/player.py): `espn_api/baseball/player.py`
- [Baseball transactions](https://github.com/cwendt94/espn-api/blob/master/espn_api/baseball/transaction.py): `espn_api/baseball/transaction.py`
- [Baseball matchups](https://github.com/cwendt94/espn-api/blob/master/espn_api/baseball/matchup.py): `espn_api/baseball/matchup.py`
- [WNBA league](https://github.com/cwendt94/espn-api/blob/master/espn_api/wbasketball/league.py): `espn_api/wbasketball/league.py`
- [WNBA player](https://github.com/cwendt94/espn-api/blob/master/espn_api/wbasketball/player.py): `espn_api/wbasketball/player.py`
- [WNBA matchups](https://github.com/cwendt94/espn-api/blob/master/espn_api/wbasketball/matchup.py): `espn_api/wbasketball/matchup.py`

### Other components

- **API caller**
- **ESPN Fantasy API**

## Connections

- API caller → Football league: creates league
- API caller → Basketball league: creates league
- API caller → Hockey league: creates league
- API caller → Baseball league: creates league
- Football league → Shared league: inherits from (evidence: `espn_api/football/league.py`)
- Basketball league → Shared league: inherits from (evidence: `espn_api/basketball/league.py`)
- Hockey league → Shared league: inherits from (evidence: `espn_api/hockey/league.py`)
- Baseball league → Shared league: inherits from (evidence: `espn_api/baseball/league.py`)
- WNBA league → Shared league: inherits from (evidence: `espn_api/wbasketball/league.py`)
- Shared league → ESPN requests: fetches league data (evidence: `espn_api/base_league.py`)
- ESPN requests → ESPN Fantasy API: sends HTTP requests (evidence: `espn_api/requests/espn_requests.py`)
- ESPN requests → Request logging: logs responses (evidence: `espn_api/requests/espn_requests.py`)
- Shared league → League settings: builds settings (evidence: `espn_api/base_league.py`)
- Shared league → Draft picks: builds picks (evidence: `espn_api/base_league.py`)
- Shared league → Trade enrichment: uses trade filling (evidence: `espn_api/base_league.py`)
- Football league → Football player: uses players (evidence: `espn_api/football/league.py`)
- Football league → Football matchups: uses matchups (evidence: `espn_api/football/league.py`)
- Football league → Football transactions: builds transactions (evidence: `espn_api/football/league.py`)
- Football league → Auction offers: uses offers (evidence: `espn_api/football/league.py`)
- Football player → Trade enrichment: parses transactions (evidence: `espn_api/football/player.py`)
- Basketball league → Basketball player: uses players (evidence: `espn_api/basketball/league.py`)
- Basketball league → Basketball matchups: uses matchups (evidence: `espn_api/basketball/league.py`)
- Basketball league → Basketball transactions: builds transactions (evidence: `espn_api/basketball/league.py`)
- Basketball player → Trade enrichment: parses transactions (evidence: `espn_api/basketball/player.py`)
- Hockey league → Hockey player: uses players (evidence: `espn_api/hockey/league.py`)
- Hockey league → Hockey matchups: uses matchups (evidence: `espn_api/hockey/league.py`)
- Baseball league → Baseball player: uses players (evidence: `espn_api/baseball/league.py`)
- Baseball league → Baseball matchups: uses matchups (evidence: `espn_api/baseball/league.py`)
- Baseball league → Baseball transactions: builds transactions (evidence: `espn_api/baseball/league.py`)
- Baseball player → Trade enrichment: parses transactions (evidence: `espn_api/baseball/player.py`)
- WNBA league → WNBA player: uses players (evidence: `espn_api/wbasketball/league.py`)
- WNBA league → WNBA matchups: uses matchups (evidence: `espn_api/wbasketball/league.py`)
