As far as I can tell PyPI supports returning 304 Not Modified
if the response it would send matches the etag in the If-None-Match
request header. If you’re polling PyPI periodically that’ll save duplicate downloads.
Example:
import requests
resp = requests.get("https://pypi.org/pypi/whey/json")
assert resp.status_code == 200
etag = resp.headers["Etag"]
resp2 = requests.get("https://pypi.org/pypi/whey/json", headers={"If-None-Match": etag})
assert resp2.status_code == 304, resp2.status_code