Last Updated : 12 Jul, 2025
The requests library is a powerful and user-friendly tool in Python for making HTTP requests. The PUT method is one of the key HTTP request methods used to update or create a resource at a specific URI.
Working of HTTP PUT Methodrequests.put(url, params={key: value}, **args)
Parameters:
To use the requests module, we need to first install it using this command:
Example – Making a PUT Requestpip install requests
In this example, we are going to make a real PUT Request using httpbin.org, a public testing API.
Python
import requests
res = requests.put('https://httpbin.org/put', data={'key': 'value'})
print("Status Code:", res.status_code)
print("Response Body:", res.content.decode())
Output:
Terminal OutputExplanation:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4