8
我正在嘗試使用Instapaper's simple developer api來使用python和請求庫向我的書籤添加一個url。驗證用戶名和密碼都可以正常工作。Python使用三個參數請求庫HTTPBasicAuth
import requests
from requests.auth import HTTPBasicAuth
requests.get('https://www.instapaper.com/api/authenticate', auth=HTTPBasicAuth('username', 'password'))
但是,試圖使用API添加書籤時:
requests.get('https://www.instapaper.com/api/add', auth=HTTPBasicAuth('username', 'password','websiteUrl'))
我得到錯誤:
File "instantbookmark.py", line 3, in <module>
getA = requests.get('https://www.instapaper.com/api/add', auth=HTTPBasicAuth('username', 'password','websiteUrl'))
TypeError: __init__() takes exactly 3 arguments (4 given)
我想這是因爲HTTPBasicAuth不能把第三個參數,有沒有人知道一種方法來做到這一點?
這是完整的回溯錯誤 – Wilberto 2013-02-10 12:42:46
是的,我檢查了請求的來源和API的文檔,請參閱下面的答案。 – 2013-02-10 12:43:21