I've used a variety of python HTTP libs in the past, and I've settled on requests as my favourite. Existing libs had pretty useable interfaces, but code can end up being a few lines too long for simple operations. A basic PUT in requests looks like:

payload = {'username': 'bob', 'email': '[email protected]'}
>>> r = requests.put("http://somedomain.org/endpoint", data=payload)

You can then check the response status code with:

r.status_code

or the response with:

r.content

Requests has a lot synactic sugar and shortcuts that'll make your life easier.

Answer from John Bear on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › put-method-python-requests
PUT method - Python requests - GeeksforGeeks
July 12, 2025 - data parameter inside requests.put() is used to pass the key-value data to be updated or created on the server. print(r) displays the response object, including the HTTP status code (e.g., 200 for success). print(r.content) prints the response ...
🌐
Requests
requests.readthedocs.io › en › latest › user › quickstart
Quickstart — Requests 2.33.0 documentation
If you were constructing the URL by hand, this data would be given as key/value pairs in the URL after a question mark, e.g. httpbin.org/get?key=val. Requests allows you to provide these arguments as a dictionary of strings, using the params keyword argument. As an example, if you wanted to pass key1=value1 and key2=value2 to httpbin.org/get, you would use the following code:
Discussions

HTTP PUT request in Python using JSON data - Stack Overflow
Your data is already a JSON-formatted string. You can pass it directly to requests.put instead of converting it with json.dumps again. More on stackoverflow.com
🌐 stackoverflow.com
Put request using python
What response do you get by the server? Is it a 200? More on reddit.com
🌐 r/learnpython
8
1
February 8, 2022
Building a Python PUT/UPDATE request dictionary
Dataframes have a to_dict method, so you can easily iterate on each row's dict then modify it for the API call or create a new one picking the necessary values from the given one. More on reddit.com
🌐 r/learnpython
3
1
November 23, 2021
I don't really understand Requests python module
You might want to start with some basics on client-server communication before delving into networking/web-dev side of Python. As others have mentioned here, requests docs is a great place to learn about the library, but if you don't know what a 'POST' or 'GET' method is or what's a request header used for, the docs won't make much sense. There are plenty of free online resources which explains the above concepts. Listing some of them which I think should cover your case: https://www.freecodecamp.org/news/http-request-methods-explained/ https://doc.oroinc.com/api/http-methods/ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON More on reddit.com
🌐 r/learnpython
45
100
July 24, 2022
🌐
Codecademy
codecademy.com › docs › python › requests module › .put()
Python | Requests Module | .put() | Codecademy
May 15, 2024 - ... **kwargs are any number of ... be passed into a PUT request. For example, they can be used to include cookies in the request, set proxies, set headers, or set a page timeout....
🌐
Apidog
apidog.com › blog › python-put-request
How to make a PUT Request in Python (2026 Guide)
February 2, 2026 - HTTP Request BasicsWhat is a PUT request?What is Python?How to make a PUT request using PythonExample 1: Sending Form DataExample 2: Sending XML DataExample 3: Sending Plain TextUnderstanding the PUT request parameters in Python.Using Apidog to Test Your Python PUT RequestBest practices for making a PUT Request.Conclusion · Apidog: A Real Design-first API Development Platform ... Master Claude Sonnet 4.6 API with practical examples.
🌐
Tutorialspoint
tutorialspoint.com › python › python_requests_put_method.htm
Python Requests put() Method
Following is the syntax and parameters of Python Requests put() method − ... kwargs(optional): Optional arguments that can be passed including headers, cookies, auth, timeout etc. This method returns a Response object. Following is the basic example of a basic PUT request using python requests ...
🌐
Python Examples
pythonexamples.org › python-requests-http-put
Python - Send HTTP PUT Request
In Python Requests library, requests.put() method is used to send a PUT request to a server over HTTP. You can also send additional data in the PUT request using data parameter. In this example, we shall send a HTTP PUT Request to the server at /. We shall also send data in the PUT request.
Find elsewhere
🌐
W3Schools
w3schools.com › python › module_requests.asp
Python Requests Module
C:\Users\Your Name\AppData\Local\Programs\Python\Python36-32\Scripts>pip install requests ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report ...
🌐
Real Python
realpython.com › python-requests
Python's Requests Library (Guide) – Real Python
July 23, 2025 - In the example above, you called each function to make a request to the httpbin service using the corresponding HTTP method. All of these functions are high-level shortcuts to requests.request(), which takes the method name as its first argument: ... You could use the equivalent lower-level function call, but the power of Python’s Requests library is in its human-friendly, high-level interface.
🌐
ReqBin
reqbin.com › req › python › p2fujlvb › put-request-example
Python | How to send a PUT request?
January 15, 2023 - In contrast to a PATCH request, ... must have a complete copy of the data. In this Python PUT Request Example, we send JSON to the ReqBin echo URL....
🌐
Apidog
apidog.com › blog › python-put-request-headers
How to make a PUT Request in Python with headers
October 28, 2024 - These examples demonstrate how to make PUT requests with different content types and data formats using the requests library in Python.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-requests-tutorial
Python Requests - GeeksforGeeks
July 31, 2025 - Python Requests Library is a simple and powerful tool to send HTTP requests and interact with web resources. It allows you to easily send GET, POST, PUT, DELETE, PATCH, HEAD requests to web servers, handle responses, and work with REST APIs and web scraping tasks.
🌐
Scrapfly
scrapfly.io › blog › posts › how-to-python-requests-post
Guide to Python requests POST method - Scrapfly Blog
November 5, 2024 - PUT: Updates existing resources, such as modifying user profiles. DELETE: Removes specified resources from the server. PATCH: Partially updates existing resources. HEAD: Requests only the headers (meta info) of a response without the body.
🌐
Reddit
reddit.com › r/learnpython › put request using python
r/learnpython on Reddit: Put request using python
February 8, 2022 -

Hey everyone,
I am building a system with an ESP32 microcontroller, which should adjust the time according to the date. I have an external file that I want to get the current date-time and put on the server, then the micmicrocontroller asks for the time and adjust it. I have created a server, I can acaccesst and use get requests, but I can not put information there, which is what I need. What can I do here?

import datetime
import requests
req = requests.get('http://192.168.137.10:8081/')

j_data = {"time": "something", "mode": "mode"}
print(req.text)
url = 'http://192.168.137.10:8081/'
req1 = requests.put(url, j_data)

🌐
ReqBin
reqbin.com › code › python › ixa9gi7o › python-http-request-example
How do I send HTTP request using Python Requests Library?
In this Python HTTP Requests example, we send a GET request to the ReqBin echo URL with a custom HTTP header. Below you can see more examples of HTTP methods with Python Requests.
🌐
Oxylabs
oxylabs.io › blog › python-requests
Python Requests Library: 2026 Guide
Our basic Python requests example will return a <Response [200]> message. A 200 response is ‘OK’ showing that the request has been successful. Response messages can also be viewed by creating an object and print(object.status_code).
🌐
GitHub
github.com › WilliamQLiu › python-examples › blob › master › requests › example_requests.py
python-examples/requests/example_requests.py at master · WilliamQLiu/python-examples
http://docs.python-requests.org/en/latest/api/ · Commands · GET · Read an existing resource. This is like SELECT in SQL · HEAD · Similar to GET except server doesn't return a message-body in · response. Instead, it gets the metadata of an existing resource. POST · Creates a new resource. This is like INSERT in SQL · PUT ·
Author   WilliamQLiu