Instagram API OauthException:"您必须提供client_id"

时间:2014-07-10 11:29:51

标签: python api instagram python-requests access-token

当我尝试从Instagram.收到access_token时,我会执行以下请求

params = {
    'client_id' : config.INSTAGRAM_APP_ID,
    'client_secret' : config.INSTAGRAM_APP_SECRET_KEY,
    'grant_type' : 'authorization_code',
    'redirect_uri' : '`my localhost`',
    'code' : code
    }
r = requests.post('https://api.instagram.com/oauth/access_token', params = params)

收到错误:

{"code": 400, "error_type": "OAuthException", "error_message": "You must provide a client_id"}

我可以用这些做什么?

2 个答案:

答案 0 :(得分:1)

我通过将这些参数放在(x-www-form-encoded)正文而不是标题中来修复此问题(归功于https://github.com/request/request/issues/983#issuecomment-57005849这个想法)。

注意:我没有使用python包装器。

答案 1 :(得分:0)

使用generateSequence(1) { n -> n * 2 } .take(20) .forEach(::println) app_id

对于邮递员,请将身体参数放在app_secret中。