Hi DeepLearning.AI team,
c2w2a1-105953 solution is not posted, unlike other labs.
I’m getting an error “Error requesting data: ‘function’ object has no attribute ‘items’” and don’t know how to proceed.
Thanks
Hi DeepLearning.AI team,
c2w2a1-105953 solution is not posted, unlike other labs.
I’m getting an error “Error requesting data: ‘function’ object has no attribute ‘items’” and don’t know how to proceed.
Thanks
Hello @sahilgupta.nus
If you are referring to Graded Programming Assignment 2: Batch Data Processing from an API, this is an assignment, and, unlike practice labs, the solution to the assignments is not provided. However, if you get stuck in any part of the lab, you can ask for help here in the discourse. Please, be specific about which part of the lab you are facing the issue and what the exact issue is.
I am getting the same error, I feel like I am missing something in the instructions. The following error: Error requesting data: ‘str’ object has no attribute ‘items’
[18]:
{‘error’: AttributeError(“‘str’ object has no attribute ‘items’”)}
These are the instructions that I have: Exercise 1
Follow the instructions to complete the get_featured_playlists
function:
get_auth_header
and pass to it the access token (which is specified as input to the get_featured_playlists
function). Save the output of get_auth_header
to a variable called headers
.request_url
variable. Use this URL and the header from the previous step to perform a get()
request.response
is an object of type requests.models.Response
. This object has a method named json()
that allows you to transform the response content into a JSON object or plain Python dictionary. Use this method on the response
object to return the content as a Python dictionary.Then you will use the provided URL_FEATURE_PLAYLISTS
URL or endpoint to perform calls to the API, passing the access_token
value from the token
object that you obtained before.
I think my trouble is with the following code:
Any advice? Hints?
Hello @PressureDrop ,
I couldn’t reproduce the issue ‘hase no attribute items’.You shouldn’t hardcode the request_url, you should keep it so the offset will be updated later in the code. Could you try not to share code please, Thanks
I don’t know how to communicate what I am doing and seeing without sharing code. I am not certain what you mean about the request_url variable. It isn’t clear, from the instructions, whether that is something that has been created previously or needs to be as part of this exercise.
@PressureDrop, I was about to tell you that without sharing code,its against the code of conduct. you should keep url=request_url but you could post a screeshot of the exercise 1 output which should be a playlists_response
dict. You do not need ot post code, the issue could be in other place of the code. Thanks
That is the only part of the code that is indicated to be edited for this exercise. Not sure how the issue could be elsewhere.
@PressureDrop, yes there is a bug in your code headers=‘headers’ (just use headers) and also remove hardcode the url
, You don’t need ot use quotes just follow the instuctions (acceess token instead of “access_token” etc). Could you edit your previous post and remove your cell code. Thanks so I can give any advice
Thanks Georgios, that’s done the job. The instructions might just add the advice, no quotes. Thanks again!
Hello
No matter what I do in this Exercice 1 I get this output : {‘error’: {‘status’: 404, ‘message’: ‘Not Found’}}
Maybe the provided URL is broken ?
I have debug tested all the parameters of the functions for this cell and (the previous ones). I get my access token successfully. The code to replace seams very simple and straighforward with the hints gave in comments. I have no syntax errors…
I tried also to renew the secret from the API, delete and create again the spotify app connection, still the same result…
All is working properly except for this 404 error.
I managed to make it work once before by retrieving numerous playlist in JSON format but now it seems totally broken.
Can someone confirm this lab is still working as intended ?
Your help would be greatly appreciated !
Thanks
I was having the same issue this afternoon when it had been working on the morning. I’m just going to try again tomorrow morning.
Thanks PressureDrop for your feedback, I created a proper topic on this matter (C2W2 - Graded Assignment 2 : Maybe broken following 2024/11/27 Changes to Web API from Spotify) because I think the problem comes from a change from Spotify that occured today regarding the web API : Introducing some changes to our Web API | Spotify for Developers
Oh! Thank you for that information!