C2W2A1: Batch Data Processing from API - Exercise 2 - no scheme error

Hi everyone, I’ve been stuck at this C2W2 Assignment 1 Exercise #2 for a while now, and decided to seek assistance. I’ve checked its corresponding my Exercise #1, it all seems to be working OK.

I am unsure what the “no scheme supplied” error mean here. I assume that this error is causing the following “AttributeError”?

Did I miss something in the paginated_new_releases function? If anyone is able to put me in the right direction that would be much appreciated.

I’ve attached a screenshot of the error, I hope this is OK to share.
Cheers,

Hi @voliveir - It looks like you passed an invalid URL to the API request. In the “paginated_new_releases” function, can you share how you defined kwargs and how you have defined “response” after kwargs?

Hi @hawraa.salami - In the paginated_new_releases function, I defined “kwargs” and “response” as follows:

kwargs = {
“url”: str,
“access_token”: str,
“offset”: int,
“limit”: int,
}
response = endpoint_request(**kwargs)

where can i find the solution page of this lab?

Hello @udaya_bhandarkar,
This is not a practice lab, Graded Programming Assignment 2: Batch Data Processing from an API is graded assignent and there are no solutions provided. Thank you

1 Like

Hello @voliveir,
In your dictionary you should use the values corresponding to the keys:
So you could use the same values as the keys instead (url, offset etc) You can see Exercise 3 which use the same logic as Exercise 2. Thank you

3 Likes

Hey I got the same issue today. Then I realized it’s the issue of token. The token you got from previous step only valid for 1 hour. You re-run the function to retrieve the token, and the function paginated_new_releases function should work.

1 Like

Hello @Amberzy,
That is correct it expires after 60 minutes with a 401 error. Should fix if you refresh the token, thanks

Hi,

I am having the same issue as well.
I have this code but the results I get all show 0. The offset dose not increase.

AM I having the kwargs values wrong? I’m stuck. Maybe I am missing something here. Please advise. Thanks.

Hello @kayajohnm,

There is no real issue using those values in the kwargs dictionary, but you should avoid hardcoding. Instead, you can see exercise 3 and use in your dictionary the values corresponding to the keys (url,access_token,offset,limit).

The issue with the offset not updating has to do with the previous exercise 1 get_new_releases, you need to perform a get request using the request_url. You need to use url=request_url and not hardcode it. Hope it helps

It worked. Thank you so much @Georgios !

1 Like