python - get request only returning half the data is should - Stack Overflow

admin2025-05-01  0

I am using spotifys get recently played tracks endpoint to get the last 50 songs I've listened to. However my response is seemingly getting cut off half way through the items array. This worked fine this morning and I have not altered any of the code so I can't think why it suddenly is no longer working.

def get_recent_tracks(token,unix_time):
    url = ";
    headers = get_auth_header(token)
    parameters = {
         "limit": 50,  #max limit is 50
         "after" : unix_time
    }
    tracks = get(url,params = parameters, headers= headers)
    recent_tracks_json = json.loads(tracks.content)

    return (recent_tracks_json)

recentTracks = get_recent_tracks(token,1732652000)

My access token is definitely working fine and the response code is 200.

Details for the endpoint -

code response

It's stopping at towards the end of the href line, below image is the full response I expect, with multiple iterations of this. correct syntax

转载请注明原文地址:http://anycun.com/QandA/1746108188a91783.html