X-Deprecated header implementation
hkraal opened this issue · comments
As we're getting close to implementing versioning into pycrest I suppose we should support the X-Deprecated
header as well.
Question is: should we strive to implement this for a future update or the upcoming release (I think the latter)
My thoughts:
- raise DeprecationWarning messages when the header is present
- log deprecation messages
- add param to
__call__()
to suppress these messages
The X-Deprecated Header
To help you find out when a resource is updated, old versions will send an X-Deprecated header. It is up to you to decide what to do with this in your app to help alert you to update it.
source: versioning.md
Maybe dont need to do much about it - it will be stored in the headers of the ApiResponse so if that's available to people then they can check for the header themselves?
Regarding deprecation warning messages, if you think about how many requests you might do to some endpoints, it could mean utterly spamming people with those messages.
you could store the queried endpoints and just output one time for each endpoint per version, some logic to control the spamming shouldn't be too difficult?
I think you won't get spammed anyway, as the doc says:
Repetitions of a particular warning for the same source location are typically suppressed
Requires a test ^^
It also looks like you can set a warning filter to only throw them once, or explicitly "deactivate" them (28.6.3 in the doc)