Open geoffbeier opened 2 years ago
I have most of a PR done that makes this change, and plan to send it soon. I thought it'd be worth opening this issue to discuss it while I'm cleaning it up.
Thanks for looking into this!
I'll leave comments on the PR.
I just found this library, and it's great. It's saving me a ton of work. As I'm using it, there are two features I want:
Since pymfl uses requests to interact with the MFL API, a relatively small addition to the public interface is enough to make it so that applications can turn on caching (and even set different cache rules per-API) and store cookies between runs.
By adding a
requests.Session
parameter (defaulted to None) to theAPIConfig.add_config_for_year_and_league_id
and having pymfl hang onto that with theYearAPIConfig
, then having the client base class use that session instead of the raw cookie value, callers who want caching and saving can get it, with no interface changes for callers who don't care about that.Assuming a caller wants to use requests-cache for caching and a cookiejar from the standard library
http.cookies
, caching and saving cookies would then look something like this: