0
0
Rest APIprogramming~10 mins

Retry-After header in Rest API - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the Retry-After header with a delay of 120 seconds.

Rest API
response.headers['Retry-After'] = '[1]'
Drag options to blanks, or click blank then click option'
ANone
B'120'
C'120 seconds'
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using a boolean value instead of a number
Including units like 'seconds' in the value
2fill in blank
medium

Complete the code to set the Retry-After header with a HTTP date string.

Rest API
response.headers['Retry-After'] = '[1]'
Drag options to blanks, or click blank then click option'
A2025-10-21T07:28:00Z
B21/10/2025 07:28:00
C"Wed, 21 Oct 2025 07:28:00 GMT"
D07:28:00 GMT
Attempts:
3 left
💡 Hint
Common Mistakes
Using ISO 8601 date format
Using incomplete date strings
3fill in blank
hard

Fix the error in setting the Retry-After header with a numeric value.

Rest API
response.headers['Retry-After'] = [1]
Drag options to blanks, or click blank then click option'
ATrue
B120
CNone
D'120'
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning an integer directly instead of a string
Using None or boolean values
4fill in blank
hard

Fill both blanks to set Retry-After header with seconds and check if status code is 429.

Rest API
if response.status_code [1] 429:
    response.headers['Retry-After'] = '[2]'
Drag options to blanks, or click blank then click option'
A==
B!=
C120
D60
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '=='
Setting Retry-After to wrong value
5fill in blank
hard

Fill all three blanks to create a dictionary with Retry-After header set only if status is 503 and delay is over 30 seconds.

Rest API
headers = {}
if status_code [1] 503 and delay [2] 30:
    headers['Retry-After'] = '[3]'
Drag options to blanks, or click blank then click option'
A==
B>
C30
D60
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operators
Setting Retry-After to incorrect value