(使用mac)编程入门都没有的新手提问:
我想要爬取一些patreon平台的api,然后存json文件,然后下载了这个git后不知道怎么去用
https://github.com/Patreon/patreon-python
还有就是做到第第四步卡住了https://docs.patreon.com/#step-4-validating-receipt-of-the-oauth-token
大致是这个报错{'error': 'invalid_grant'}
,直接输入那个网页的话就是405MethodNotAllowed
完全编程小白,希望能仔细讲解,可追加c币
根据你文档的描述,第四步
POST www.patreon.com/api/oauth2/token
你直接访问网页肯定不行,那个是get,要post
这一步服务器返回的json
{
"access_token": <single use token>,
"refresh_token": <single use token>,
"expires_in": <token lifetime duration>,
"scope": <token scopes>,
"token_type": "Bearer"
}
注意看access_token
之后的提交,附带上它,就不会出现405权限拒绝了。
第四步的post的数据中
code=<single use code, as passed in to GET route [2]>
&grant_type=authorization_code
&client_id=<your client id>
&client_secret=<your client secret>
&redirect_uri=<redirect_uri>
你的验证码、密钥等是不是正确呢?
特别注意,code是每次都不同的。