Complete the code to set the HTTP status code for too many requests.
response.status_code = [1]The HTTP status code 429 means "Too Many Requests". It tells the client to slow down.
Complete the code to add a Retry-After header with 60 seconds.
response.headers['[1]'] = '60'
The Retry-After header tells the client how many seconds to wait before retrying.
Fix the error in the code to correctly check if the status code is 429.
if response.status_code [1] 429: print('Rate limit exceeded')
To check if the status code is exactly 429, use the equality operator ==.
Fill both blanks to create a dictionary comprehension that maps IPs to their request counts only if count is greater than 100.
ip_counts = {ip: [1] for ip, count in requests.items() if count [2] 100}The dictionary maps each IP to its count, but only includes IPs with counts greater than 100.
Fill all three blanks to create a dictionary comprehension that maps user IDs to their names only if their request count is less than 50.
user_names = { [1]: [2] for [3], data in users.items() if data['requests'] < 50 }The dictionary comprehension maps each user_id to their name if their request count is less than 50.