Crossin的编程教室
标题:
有关NBA球员出手喜好源码的问题
[打印本页]
作者:
ak47rong
时间:
2020-1-18 08:40
标题:
有关NBA球员出手喜好源码的问题
这是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)
请问该如何解决??
作者:
crossin先生
时间:
2020-1-20 23:01
这个官方数据接口最近突然失效了,暂时还没找到替代,所以确实没法成功
过阵子看看会不会恢复吧,我也再找找看有没有新接口
欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/)
Powered by Discuz! X2.5