1

I got confused between the data and params in requests.session class. What is the difference between data and params?. When do we need to use it and what will be the output difference?

http://docs.python-requests.org/en/latest/api/#requests.Session.request

0

1 Answer 1

2

params attaches the parameters to the URL, for a GET request, e.g.:

http://www.example.com/page.php?param1=value1&param2=value2

data, however, adds the (encoded) data to the request body, as in a POST request, so the values do not show up in the URL. This request may then look like:

POST /page.php HTTP/1.0
Host: www.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 27

param1=value1&param2=value2
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.