-
Notifications
You must be signed in to change notification settings - Fork 111
Caching #100
Comments
Down at the end of the requests-cache README, it says
The Mapbox APIs do have cache control headers we can use, so let's do check out CacheControl: http://cachecontrol.readthedocs.org/en/latest/. |
👍 requests-cache is more helpful for web scraping and end-user caching, not exactly a true web client caching mechanism like CacheControl. |
By default, CacheControl caches to an in-memory dictionary which doesn't persist when the process stops. This would only help for long-running clients, not so much for the mapbox cli. There is an option to use file caching which uses pickling to serialize requests. This requires an extra level of configuration (user may want to specify the cache file location) but might be useful.
In general, it seems like there are a lot of unmerged PRs and open bugs so I'm not sure how actively it is maintained. |
Initial report: adding a simple wrapper using the dictionary store seems to work well. This passes both the unit tests and the doctests
However, both the unit tests and doctests fail when you add By adding |
I'm going to tackle this issue tonight. Basically:
|
The base service class can use an HTTP cache. Closes #100.
We might want to add optional caching via https://pypi.python.org/pypi/requests-cache
This would allow clients to store raw responses locally and reduce the burden on the API, particularly when developing and testing where the requests are likely to be repetitive.
The text was updated successfully, but these errors were encountered: