【问题标题】:Unable to get tokens from get_raw_request_token() in Rauth无法从 Rauth 中的 get_raw_request_token() 获取令牌
【发布时间】:2013-12-11 08:47:42
【问题描述】:

我正在使用 Rauth 请求 Beatport API

以下是我的部分代码

from rauth import OAuth1Service

beatport = OAuth1Service(
    name='beatport',
    consumer_key='xxxxxxxxxxxxxxxxxxxxxxxx',
    consumer_secret='xxxxxxxxxxxxxxxxxxxxxxx',
    request_token_url='https://oauth-api.beatport.com/identity/1/oauth/request-token',
    access_token_url='https://oauth-api.beatport.com/identity/1/oauth/access-token',
    authorize_url='https://oauth-api.beatport.com/identity/1/oauth/authorize',
    base_url='https://oauth-api.beatport.com/json/catalog')

print beatport.get_raw_request_token()

request_token, request_token_secret = beatport.get_raw_request_token()

print beatport.get_raw_request_token() 打印响应 [405]。我使用的消费者密钥和消费者秘密是正确有效的。

Beatport API Documentation

Rauth Documentation

我做错了什么?

【问题讨论】:

    标签: python api oauth rauth


    【解决方案1】:

    调用beatport.get_raw_request_token() 的值是Requests 的响应对象。使用这个对象,您可以准确地看到发生了什么。但是,即使只是打印出来,你也可以看到返回码是 HTTP 405。这个响应码表示“Invalid Method”,表示使用的请求方法不正确。您可能需要使用 GETPOST(我忘记了这里的默认请求方法)来满足 Beatport API。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-17
      • 2013-03-05
      • 2023-02-14
      • 2022-01-22
      • 1970-01-01
      • 2018-10-10
      • 2018-12-30
      相关资源
      最近更新 更多