jldbc / jldbc/pybaseball

Aggregate stats > 10 years gives FanGraphs 5xx

Open
#492 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

### Observed Behavior
When I try to poll for player stats of > 10 years using `batting_stats` or `pitching_stats` APIs, for instance with the following call:
```
raw_accumulated_batting_stats = batting_stats(2008, 2019, ind=0)
```
I see a FanGraphs 5xx:
```
requests.exceptions.HTTPError: Error accessing 'https://www.fangraphs.com/leaders-legacy.aspx'. Received status code 500
```
Looking at that link and aggregating for stats > 10 years (from 2008-2019 for instance, or 2009-2020), FanGraphs throws a 5xx. This seems like a limitation of FanGraphs rather than this API.

### Expected Behavior
One of the following
- Fail gracefully in this scenario (potentially suggest that stats aggregated over 10+ years are not supported)
- Make multiple calls to FanGraphs for stats < 10 years and manually aggregate the data

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.