Complete the code to start an asynchronous operation by sending a POST request.
response = requests.post('[1]/start-operation')
The correct URL scheme for HTTP REST APIs is http://. FTP, file, and SMTP are not used for REST API calls.
Complete the code to check if the operation status is 'completed'.
if status == '[1]':
The operation is finished when the status is completed. Other statuses mean it is still running or failed.
Fix the error in the code to correctly poll the operation status until it is completed.
while status != '[1]': time.sleep(5) status = get_status(operation_id)
The loop should continue until the status is completed. Using any other status will cause an infinite loop or wrong behavior.
Fill both blanks to create a dictionary comprehension that maps operation IDs to their statuses only if the status is 'completed'.
completed_ops = {op_id: [1] for op_id, [2] in operations.items() if status == 'completed'}The dictionary comprehension uses status as the value and iterates over op_id, status pairs.
Fill all three blanks to create a dictionary comprehension that maps uppercase operation IDs to their results only if the result is greater than 0.
filtered_results = { [1]: [2] for op_id, [3] in results.items() if [2] > 0 }The comprehension uses op_id.upper() as the key, result as the value, and unpacks op_id, result from the dictionary.