Reputation: 23
Im pretty new to Python Requests so bear with me. Im trying to POST a requests with the following data
data = {
"form_uuid": "taGE9xyeDAYWQw_MyeQvIw",
"formResponse": {"First Name (As per IC/ID)": "nancy",
"Last Name (As per IC/ID)":"thomas",
"E-mail":"[email protected]",
"Size Selection (US)":"8.5"},
"confirmationMail": "[email protected]",
"is_pro": "true"
}
enter_raffle = requests.post(URL,data=data)
However, because of the dictionary within the dictionary itself, I cant seem to properly recreate the request. If it helps, this is what the form data looks like on the chrome network panel formdata
I observed that the request headers' content type was "application/x-www-form-urlencoded" too if that helps
Upvotes: 0
Views: 292
Reputation: 530773
The formResponse
value appears to be JSON. You could try
import json
response = {
"First Name (As per IC/ID)": "nancy",
"Last Name (As per IC/ID)":"thomas",
"E-mail":"[email protected]",
"Size Selection (US)":"8.5"
}
data = {
"form_uuid": "taGE9xyeDAYWQw_MyeQvIw",
"formResponse": json.dumps(response),
"confirmationMail": "[email protected]",
"is_pro": "true"
}
enter_raffle = requests.post(URL,data=data)
Upvotes: 1