Instagram API OauthException:“您必须提供一个client_id”

San*_*tsa 7 python api access-token instagram python-requests

当我尝试接收来自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)
Run Code Online (Sandbox Code Playgroud)

并收到错误:

{"code": 400, "error_type": "OAuthException", "error_message": "You must provide a client_id"}
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

gir*_*uru 7

我通过将这些参数放在(x-www-form-encoded)正文中而不是在标头中来解决此问题(该想法的信箱https://github.com/request/request/issues/983#issuecomment-57005849) 。

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