为Python Instagram API生成访问令牌需要运行this file,然后输入客户端ID,客户端密钥,重定向URI和范围。然后控制台输出一个URL来跟踪以授权应用程序并询问之后生成的代码。理论上,在此过程之后,它应该返回一个访问令牌。
相反,它会抛出错误:
Traceback (most recent call last):
File "get_access_token.py", line 40, in <module>
access_token = api.exchange_code_for_access_token(code)
File "C:\Users\Daniel Leybzon\Anaconda2\lib\site-packages\instagram\oauth2.py", line 48, in exchange_code_for_access_token
return req.exchange_for_access_token(code=code)
File "C:\Users\Daniel Leybzon\Anaconda2\lib\site-packages\instagram\oauth2.py", line 115, in exchange_for_access_token
raise OAuth2AuthExchangeError(parsed_content.get("error_message", ""))
instagram.oauth2.OAuth2AuthExchangeError: You must provide a client_id