[Fixed]-Python error parsing json

1👍

The webpage might be expecting a web browser to request the data from the URL. Try adding a user-agent to your request.

import requests
HEADERS = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/31.0'}
urlPlayerLog = "http://stats.nba.com/stats/playergamelog?DateFrom=&DateTo=&LeagueID=00&PlayerID=203518&Season=2016-17&SeasonType=Pre+Season"
responses = requests.get(urlPlayerLog, headers=HEADERS)
dataGameLogs = responses.json()['resultSets'][0]['rowSet']
👤Ken

Leave a comment