Python 3.x 试图将Yahoo Fantasy Sports API与python一起使用,但出现内部服务器错误
我正在尝试学习如何使用YahooApi,但是当从网站获取数据时,它会给我一个内部服务器错误。我尝试了联赛或联赛数据的每一种组合,甚至是一般的比赛数据,但所有的一切都给了我一个内部服务器错误。我在下面附上了我的代码,我能得到的任何帮助都会非常有用Python 3.x 试图将Yahoo Fantasy Sports API与python一起使用,但出现内部服务器错误,python-3.x,yahoo-api,Python 3.x,Yahoo Api,我正在尝试学习如何使用YahooApi,但是当从网站获取数据时,它会给我一个内部服务器错误。我尝试了联赛或联赛数据的每一种组合,甚至是一般的比赛数据,但所有的一切都给了我一个内部服务器错误。我在下面附上了我的代码,我能得到的任何帮助都会非常有用 import json import time import webbrowser import pandas as pd from pandas.io.json import json_normalize from rauth import OAuth
import json
import time
import webbrowser
import pandas as pd
from pandas.io.json import json_normalize
from rauth import OAuth1Service
from rauth.utils import parse_utf8_qsl
credentials_file = open('auth.json')
credentials = json.load(credentials_file)
credentials_file.close()
oauth = OAuth1Service(consumer_key = 'key',
consumer_secret = 'secret',
name = "yahoo",
request_token_url = "https://api.login.yahoo.com/oauth/v2/get_request_token",
access_token_url = "https://api.login.yahoo.com/oauth/v2/get_token",
authorize_url = "https://api.login.yahoo.com/oauth/v2/request_auth",
base_url = "http://fantasysports.yahooapis.com/")
request_token, request_token_secret = oauth.get_request_token(params={"oauth_callback": "oob"})
authorize_url = oauth.get_authorize_url(request_token)
webbrowser.open(authorize_url)
verify = input('Enter code: ')
raw_access = oauth.get_raw_access_token(request_token,
request_token_secret,
params={"oauth_verifier": verify})
parsed_access_token = parse_utf8_qsl(raw_access.content)
access_token = (parsed_access_token['oauth_token'],
parsed_access_token['oauth_token_secret'])
start_time = time.time()
end_time = start_time + 3600
credentials['access_token'] = parsed_access_token['oauth_token']
credentials['access_token_secret'] = parsed_access_token['oauth_token_secret']
tokens = (credentials['access_token'], credentials['access_token_secret'])
s = oauth.get_session(tokens)
r = s.get('https://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=nba.l.60379', params={'format': 'json'})
print(r.status_code)
r.json()
打印出{u'error':{u'description':u'internalserver error',u'lang':u'en-US'}似乎这个问题来自雅虎方面。一个用户报告说尝试了OAuth2身份验证,这似乎工作正常
请将您的代码作为文本而不是图像包含在内,否则您的问题将不会得到回答,并且可能会从此网站上删除。对此,我深表歉意