How to use PUT Request with Parameters in Python?

Published On: 13/09/2022 | Category: Python


Hi Guys,

Now, let's see article of python put request with query parameters. I explained simply step by step python put request example. I explained simply step by step python http put request example. I would like to show you python put request with body.

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

So let's see bellow example:

Example main.py
import requests
  
# GET Request API URL
url = 'https://reqres.in/api/users'
  
# Adding Parameters
params = dict(
    name="Bhavesh",
    job="Developer",
)
  
response = requests.put(url, params)
  
# Getting Response in JSON
data = response.json()
  
print(data)
Output:
{
    'name': 'Bhavesh', 
    'job': 'Web Developer', 
    'updatedAt': '2022-09-12T04:36:33.545Z'
}

It will help you....

Happy Python Coding!