Complete the code to send a GET request using the requests library.
response = requests.[1]('https://api.example.com/data')
The get method sends a GET request to retrieve data from the API.
Complete the code to check if the response status code is 200 (OK).
assert response.[1] == 200
The status_code attribute holds the HTTP status code returned by the API.
Fix the error in the code to parse JSON response correctly.
data = response.[1]()The json() method parses the response body as JSON and returns a dictionary.
Fill both blanks to send a POST request with JSON payload and check status code.
response = requests.[1]('https://api.example.com/create', json=[2]) assert response.status_code == 201
Use post to send data and provide the JSON payload as a dictionary.
Fill all three blanks to extract a value from JSON response and assert it equals expected.
data = response.[1]() value = data.get('[2]') assert value [3] 'success'
Parse JSON with json(), get the 'status' key, and assert it equals 'success'.
