【问题标题】:Using python-oauth2 I get oauth_parameters_absent:scope使用 python-oauth2 我得到 oauth_parameters_absent:scope
【发布时间】:2011-07-26 22:16:00
【问题描述】:

尝试在我的项目中使用 python-auth2,但我得到了:

In [1]: import oauth2 as oauth

In [2]: consumer_key='dijscrape.ep.io'

In [3]: consumer_secret='my-secret-here'

In [4]: REQUEST_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetRequestToken'

In [5]: consumer = oauth.Consumer(consumer_key, consumer_secret)

In [6]: client = oauth.Client(consumer)

In [7]: r, c = client.request(REQUEST_TOKEN_URL, "GET")

In [8]: print r
------> print(r)
{'status': '400', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'expires': 'Tue, 26 Jul 2011 13:38:13 GMT', 'server': 'GSE', 'cache-control': 'private, max-age=0', 'date': 'Tue, 26 Jul 2011 13:38:13 GMT', 'content-type': 'text/plain; charset=UTF-8'}

In [9]: print c
------> print(c)
parameter_absent
oauth_parameters_absent:scope

它可能是什么?

【问题讨论】:

    标签: python oauth


    【解决方案1】:

    Google 需要 request_token uri 的“范围”参数。

    http://code.google.com/apis/accounts/docs/OAuth.html#prepScope

    类似

    scope = "http://www.google.com/calendar/feeds/default/allcalendars/full"
    REQUEST_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetRequestToken?scope={0}'.format(scope)
    

    我注意到您尚未接受对您提出的任何问题的回答。如果答案有帮助,请记得点击答案旁边的复选标记接受它。

    【讨论】:

    • 非常感谢,对我有帮助!
    猜你喜欢
    • 1970-01-01
    • 2023-03-10
    • 2012-10-29
    • 2022-11-16
    • 2012-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-06
    相关资源
    最近更新 更多