1

私はPythonを初めて使用しますが、3時間の調査の後、問題をそれほど悪く処理していないと思います。私の POST リクエストは、Cookie のおかげでログイン ウォールをバイパスしていますが、ページに必要な情報を投稿することはありません。:(

これが私のコードです:

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

これは、WebフォームページにデータをPOSTする方法について読んだ15のトピックでアドバイスされていることとまったく同じだと思います.

print p.text.encode('utf8') は、送信しようとしているデータのない HTML を提供します。

何か案が?:)

どうもありがとうございました!

4

1 に答える 1