Complete the code to set the cache control header for 60 seconds.
response.headers['Cache-Control'] = '[1]'
Setting Cache-Control to max-age=60 tells clients to cache the response for 60 seconds.
Complete the code to check if the ETag header matches the client's If-None-Match header.
if request.headers.get('If-None-Match') == [1]:
The server compares the client's If-None-Match header with the response's ETag to decide if content is unchanged.
Fix the error in setting the 304 Not Modified response status.
if request.headers.get('If-None-Match') == response.headers.get('ETag'): return [1]
HTTP status code 304 means Not Modified, telling the client to use cached content.
Fill both blanks to create a dictionary comprehension that caches only responses with status 200.
cache = {url: response for url, response in responses.items() if response.status_code [1] [2]The comprehension keeps only responses where status_code == 200, meaning successful responses are cached.
Fill all three blanks to build a dictionary comprehension caching responses with ETag and max-age > 0.
valid_cache = {url: resp for url, resp in responses.items() if resp.headers.get([1]) and int(resp.headers.get([2], 0)) [3] 0}This comprehension caches responses that have an ETag header and a Cache-Control max-age greater than zero.