1

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
Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159
user1424739
  • 11,937
  • 17
  • 63
  • 152

1 Answers1

1

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 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"
Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159