Python Post Request with Query Parameters Example

24-Aug-2022

.

Admin

Python Post Request with Query Parameters Example

Hi Dev,

In this example, you will learn Python Post Request with Query Parameters Example. This article will give you simple example of Python Http Post Request with Parameters Example. if you have question about Python Http Post Request Json then I will give simple example with solution. I explained simply about Python Http Request Example.

Here, we will use requests library to all POST HTTP Request and get json response in python program. i will give you very simple example to call POST Request with body parameters in python.

so let's see following examples with output:

Example:


main.py

import requests

# GET Request API URL

url = 'https://reqres.in/api/users'

# Adding Parameters

params = dict(

name="Hardik",

job="Developer",

)

response = requests.post(url, params)

# Getting Response in JSON

data = response.json()

print(data)

Output:

#Python