【发布时间】:2020-09-15 20:27:55
【问题描述】:
我一直在使用 nflgame 和 nfldb 模块从 nfl xml 数据中提取时间表,但是我注意到使用以下函数生成的 URL 返回 404 错误。最近有没有其他人经历过这种情况并知道为什么会这样?
def schedule_url(year, stype, week):
"""
Returns the NFL.com XML schedule URL. `year` should be an
integer, `stype` should be one of the strings `PRE`, `REG` or
`POST`, and `gsis_week` should be a value in the range
`[0, 17]`.
"""
xmlurl = 'http://www.nfl.com/ajax/scorestrip?'
if stype == 'POST':
week += 17
if week == 21: # NFL.com you so silly
week += 1
return '%sseason=%d&seasonType=%s&week=%d' % (xmlurl, year, stype, week)
schedule_url(2019, 'REG', 1)
【问题讨论】: