下面的 Python 脚本应该授权我使用我的 Pocket 应用程序来检索文档。我正在从 Jupyter 笔记本运行它。
import json
import pandas as pd
import requests
from urllib.parse import urlencode
from urllib.request import Request, urlopen
app_key = '<app key>'
request_token_url = 'https://getpocket.com/v3/oauth/request'
auth_params = {'consumer_key': app_key,
'redirect_uri': redirect_url}
oauth = requests.post(request_token_url, data=auth_params)
token = oauth.text; print(token)
<........-....-....-....-......>
auth_url = 'https://getpocket.com/v3/oauth/authorize'
redirect_uri = '<jekyll-based static blog on github>'
usr_params = {'request_token': token, 'redirect_uri': redirect_uri}
usr = requests.post(auth_url, json = usr_params)
print(usr.text)
我一直收到状态码 400,但无法检测到错误来自何处。谢谢。