-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support If-Modified-Since headers in the APIs #23
Comments
I've looked into doing this, and the best way I can find is to store fetched data in a local database. This seems like an overly complicated implementation, so I've neglected to do it thus far. I'd love to make use of these headers if anyone can think of a better implementation, though. |
So our team is (currently) using tbapy for a project, which does involve caching data from TBA in a (pseudo-)database. Being able to pass in an If-Modified-Since, and being able to get the Last-Modified returned from the server should be enough for us. |
Yeah, that makes sense, we should definitely support that. I should have this fix out by later today. |
@auscompgeek Would you prefer to set a time on instantiating the library, or pass a parameter to every request? |
Passing in an optional date for If-Modified-Since on each request would probably be fine. |
In what format would you prefer the date to be passed? ( |
As long as the return (Last-Modified), and the input back (If-Modified-Since) have the same format, we don't really mind. We can store whatever data type (we are caching the Last-Modified time via a pickle), just whatever you think makes most sense as part of the API. |
I think it seems most reasonable to handle it with timestamps. |
Sorry I didn't get to this earlier. I'm working on it now. |
How do you want to get the returned headers? |
Could the header just be a variable of the classes? I don't understand how you built those classes so I'm not sure how to implement that. Another idea I had is using a CacheControl wrapper on the Session object to provide minimal caching for all users, but that is meant for people that want to get the same request path over and over (I'll admit I'm very guilty of this so I think the wrapper is a great idea). |
The TBA API docs recommend using the If-Modified-Since header to save time in your application and reduce load on their servers. Are there currently any plans to implement this as part of tbapy?
The text was updated successfully, but these errors were encountered: