1
我是Python新手,但我想我在3小時的研究後處理問題不算太壞。 由於cookie的原因,我的POST請求繞過了登錄牆,但它從不在網頁上發佈我想要的信息。 :(使用cookie設置Python的發佈請求,但仍不能正確發送數據
這裏是我的代碼:
import requests
url = "url"
headers = {
'Cookie': 'cookie',
'Content-Type': 'multipart/form-data',
'Accept': 'text/html,application/xhtml+xml',
'Accept-Language': 'en-gb,en;q=0.5',
'Accept-Encoding': 'gzip,deflate',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Keep-Alive': '300',
'Connection': 'keep-alive',
'Content-Length': '41'
}
payload = {
'seo_page[keyword]': 'test',
'commit': 'Save'
}
p = requests.post(url, data=payload, headers=headers)
print p.text.encode('utf8')
print p.encoding
print p.headers
這是,我認爲,正是在15個主題真實勸我讀過有關如何發佈Web窗體頁DATAS
打印頁。 text.encode(「utf-8」)給我的HTML沒有我試圖發送DATAS。
任何想法?:)
非常感謝您!