0
私はHTTPポストリクエストを送信して応答できるプログラムを作りたいと思います。PythonでHTTPポストを送信
POST https: //example.com/index.php?s=&&app=box&module=ajax§ion=coreAjax&secure_key=&type=submit&lastid=87311&global=1 HTTP/1.1
Host: example.com
Connection: keep-alive
Content-Length: 10
Accept: text/javascript, text/html, application/xml, text/xml, */*
X-Prototype-Version: 1.7.2
Origin: https://example.com
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Content-type: application/x-www-form-urlencoded; charset=UTF-8
Referer: https://x.com/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.8
Cookie: cookieconsent_status=dismiss;
そしてリクエストボディを入力します。:
だから、私はこの記事を送りたい
message= # Which I will make: "message= %s" % (messagex))
をしかし、私はそれらを送信する方法がわからないと見つけるように見えるcan'tオンラインでも、誰かが助けてくれますか?
http://requests.readthedocs.io/ja/master/をご覧ください。またはhttplibライブラリですか? – ValLeNain
@ValLeNainええ、でも、私はPythonにはまったく新しいので、これをどうやって行うのかは分かっていません。/ – Hubgum
カスタムヘッダーと複雑なPOSTリクエスト(http://requests.readthedocs.io/en)/master/user/quickstart /#custom-headers)、これはあなたが必要とするものであり、非常に簡単です。 StackOverflowで投稿する前に何か試してみることを忘れないでください;) – ValLeNain