Reputation: 13675
I have the following python code.
import requests
response = requests.request("POST"
, url = "https://services27.ieee.org/fellowsdirectory/getpageresultsdesk.html"
, data = {
'pageNum': 3
}
)
print(response.text)
But I can not figure the equivalent curl command. Does anybody know the equivalent curl command?
curl -X POST -d '{"pageNum": "3"}' https://services27.ieee.org/fellowsdirectory/getpageresultsdesk.html
Upvotes: 1
Views: 681
Reputation: 45402
What you are passing in data
is a dictionnary with the form url encoded parameters as key/value, this is not JSON data, check this
Your python code will send the following request :
POST https://services27.ieee.org/fellowsdirectory/getpageresultsdesk.html
Host: services27.ieee.org
Content-Length: 9
Content-Type: application/x-www-form-urlencoded
pageNum=3
By default curl set the content type to application/x-www-form-urlencoded
, so you can just use:
curl -d "pageNum=3" "https://services27.ieee.org/fellowsdirectory/getpageresultsdesk.html"
Upvotes: 1