I want to post password to server. Here's the server's source code(mainly):
<FORM ENCTYPE="multipart/form-data" METHOD=POST>
Password:<INPUT NAME="pw1" TYPE="password">
Password:<INPUT NAME="pw2" TYPE="password">
<INPUT TYPE="submit" VALUE="Confirm">
Below is my code:
import requests
url = 'http://192.168.0.1/pw'
file = {"pw1":"abc","pw2":"abc"}
r = requests.post(url, files = file)
From wireshark, I get:
--4d4bb99654064447b31a7afb787e5dbc
Content-Disposition: form-data; name="pw1"; filename="pw1"
abc
--4d4bb99654064447b31a7afb787e5dbc
Content-Disposition: form-data; name="pw2"; filename="pw2"
abc
--4d4bb99654064447b31a7afb787e5dbc--
What I expect is that there's no filename="pw1"/"pw2" i.e.,
--4d4bb99654064447b31a7afb787e5dbc
Content-Disposition: form-data; name="pw1"
abc
--4d4bb99654064447b31a7afb787e5dbc
Content-Disposition: form-data; name="pw2"
abc
--4d4bb99654064447b31a7afb787e5dbc--
The telegram can be recognized by server only in this way.
How to solve handle the post request? Do I have to use files if I want to use requests library in this case? Thank you for any help.