Garmin API无法验证(VerifierMissing错误)

时间:2019-06-23 08:51:27

标签: python oauth oauth-2.0 python-requests garmin

我正在尝试建立与garmin API的连接并建立至Authentiocation连接,但是出现错误:

requests_oauthlib.oauth1_session.VerifierMissing: No client verifier has been set.

有人可以提供有关如何建立连接的完整示例吗? 我的代码是:

consumer_key = "************"
consumer_secret = "************"
ACCESS_TOKEN_URL = \
    "https://connectapi.garmin.com/oauth-service/oauth/access_token"
AUTHORIZE_TOKEN_URL = "https://connect.garmin.com/oauthConfirm"
REQUEST_TOKEN_URL = \
    "https://connectapi.garmin.com/oauth-service/oauth/request_token"
oauth = OAuth1Session(client_key = consumer_key,
                     client_secret=consumer_secret)
oauth.fetch_request_token(REQUEST_TOKEN_URL)
authorization_url = oauth.authorization_url(AUTHORIZE_TOKEN_URL)
oauth_response = oauth.parse_authorization_response(authorization_url)
verifier = oauth_response.get('oauth_verifier')
oauth.token['oauth_verifier'] = verifier
oauth.fetch_access_token(ACCESS_TOKEN_URL)

错误是:

  

文件   “ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests_oauthlib/oauth1_session.py”,   319行,在fetch_access_token中       引发VerifierMissing('未设置客户端验证程序。')requests_oauthlib.oauth1_session.VerifierMissing:没有客户端验证程序   已设置。

0 个答案:

没有答案