Course 2 - Week 2 - Lab2 - Batch Data Processing from API

I’m having some doubts about this block of code:

if "None" in None:
                    # Call get_auth_header() function with the "access_token" from the token_response.
                    headers = None(
                        access_token=None["None"]
                    )
                    print("Token has been refreshed")
                    continue  # Retry the request with the updated token
                else:
                    print("Failed to refresh token.")
                    return []

I’m not understanding the “None” in “” and also the headers part, can someone please give me a tip?

Thank you in advance for your time.

Ricardo.

Hello @Ricardo_Lousada,
This is the same step as before but this time your are refreshing your auth_header if you get a 401 error. The 401 error means that your access_token has expired after 60minutes:

if the access_token in the token_response you get in the previous line, then continue:

Call the get_auth_header() function with the access_token[“access_token”] from the token_response.

Hope its helpful

Hi @Georgios, thanks for the help, I made it :slight_smile:

@Ricardo_Lousada glad it fixed, thanks

1 Like