Why do i get this response instead of correct answer?


while next_page:

Is there something wrong with my while loop?

    ### START CODE HERE ### (~ 4 lines of code)
    # Call the endpoint_request() function with the arguments specified in the kwargs dictionary.
    response = endpoint_request(**kwargs)
    # Use extend() method to add the albums' items to the list of responses.
    responses.extend(response.get('albums').get('items'))
    # Reassign the value of next_page as the 'next' value from the response["albums"] dictionary.
    next_page = response.get('albums').get('next')
    # Update the kwargs dictionary: set the value of the key 'next' as the variable next_page.
    kwargs["next"] = next_page
    ### END CODE HERE ###
    
    print(f"Executed request with URL: {response.get('albums').get('href')}.")
            
return responses

Change Below Function :
next_page = response.get(‘albums’).get(‘next’)

Solution:
next_page = response.get(‘albums’).next()

Hello @sk5479,

Could you check in Exercise 1 that you are using the correct url (url=request_url) and please remove you code, it is against the Code of Conduct. Thank you:

requests.get(url=request_url, headers..)
1 Like