- 帖子
- 1
- 精华
- 0
- 积分
- 5
- 阅读权限
- 10
- 注册时间
- 2020-1-18
- 最后登录
- 2020-1-18
|
这是NBA球员出手喜好源码的第一段(在juptyer notebook上跑):
a = input('请输入绘制图形的球员ID ')
season = '2018-19'
url = "https://stats.nba.com/stats/shotchartdetail?CFID=33&CFPARAMS=" + season + "&ContextFilter=&ContextMeasure=FGA&DateFrom=&DateTo=&GameID=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Base&Month=0&OpponentTeamID=0&Outcome=&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerID="+ a + "&PlusMinus=N&Position=&Rank=N&RookieYear=&Season=2018-19&SeasonSegment=&SeasonType=Regular+Season&TeamID=0&VsConference=&VsDivision=&mode=Advanced&showDetails=0&showShots=1&showZones=0&PlayerPosition="
print(url)
headers = {'User-Agent':'chrome'}
print('获取数据...')
# 请求含有球员投球数据的url
response = requests.get(url, headers=headers,timeout=5)
data = response.json()
data
这是报错:
ReadTimeout: HTTPSConnectionPool(host='stats.nba.com', port=443): Read timed out. (read timeout=5)
请问该如何解决??
|
|