jldbc / pybaseball

Pull current and historical baseball statistics using Python (Statcast, Baseball Reference, FanGraphs)
MIT License
1.19k stars 324 forks source link

team_pitching function cannot get relief pitching stats #275

Open Fibalious opened 2 years ago

Fibalious commented 2 years ago

Hey! I was needing to get access to fan graphs team relief pitching sheet through your package but it just was not letting me.

I looked into it and created my own temporary fix on my install.

In order to get into the relief pitching section, you need to give this parameter in your request payload: ?stats=REL

The issue is in fangraphs.py under "def fetch" there isnt a good way to insert custom requests for the "stats" parameter in url_options.

In order to get the relief pitching, it needs to have 'stats': 'REL' but the closest thing you can do is make the parameter stats_columns in the fetch parameters 'REL' but then it rejects that input through some enum

I am not gonna look too much into it, I just deleted the code that was giving the error and made a way to insert 'REL' optionally through an extra parameter in fetch

Here is the fangraphs page I was attempting to fetch fangraphs.com

If anyone could show me what I am doing wrong OR confirm this is an issue as I see, please lmk

Thanks yall for the best!

image