warehouse
warehouse copied to clipboard
Add limit and max_age params to RSS feeds
Implements https://github.com/pypa/warehouse/issues/7116, introducing limit and max_age query parameters to the packages.xml and releases.xml feeds. The limit parameter controls how many items are returned, defaulting to 40 if not present (same as current behavior) and respecting values up to 200 (an arbitrary maximum I chose, please suggest a more appropriate value). The max_age query parameter filters down to items at most max_age seconds old; I chose to use seconds of age instead of datetimes/timestamps in the request because they are easier to parse (unless I used unix timestamps, I suppose) and less sensitive to clock skew.
Creates a small _get_int_query_param utility to parse these parameters and 400 if they are not valid integers. Please let me know if there is an existing utility I should use or if I should move this to the utils module.
Currently limit requests over MAX_RESULTS (200) are silently reduced to returning MAX_RESULTS items. Should this be changed to a 400 error?
Thank you for maintaining PyPI and thanks in advance for your time reviewing this PR!
I think we probably need a bit more discussion before continuing work on this, see https://github.com/pypa/warehouse/issues/7116#issuecomment-570303891.