import requests? ? #導(dǎo)入requests庫
url="https://api.douban.com/v2/book/:id/annotations"? ? #接口地址請求的URL
#提交到接口中的數(shù)據(jù)
data={
"content":u"哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈誒",
"page":2,
"chapter":3,
"privacy":1
}
#請求頭
header={
"Content-type":"application/json"}
a=requests.post(url=url,data=data,headers=header) #賦值給a,發(fā)送post請求
print a.json() #輸出a