patch takes kwargs, just pass headers = {your_header}:

def patch(url, data=None, **kwargs):
    """Sends a PATCH request.

    :param url: URL for the new :class:`Request` object.
    :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
    :param \*\*kwargs: Optional arguments that ``request`` takes.
    :return: :class:`Response <Response>` object
    :rtype: requests.Response
    """

    return request('patch', url,  data=data, **kwargs)

So something like this:

head = {"Authorization":"Token token=xxxxxxxxxxxxxxxxxxxxxx"}
url = 'http://0.0.0.0:3000/api/v1/update_experiment.json'
payload = {'expt_name' : 'A60E001', 'status' : 'done' }

r = requests.patch(url, payload, headers=head)
Answer from Padraic Cunningham on Stack Overflow
๐ŸŒ
ReqBin
reqbin.com โ€บ req โ€บ python โ€บ 6psxhnzo โ€บ patch-request-example
Python | How do I send PATCH request?
January 15, 2023 - The Content-Type request header must indicate the data type in the body. In this Python PATCH Request example, we send JSON to the ReqBin echo endpoint to update the data on the server.
๐ŸŒ
Python Examples
pythonexamples.org โ€บ python-requests-http-patch
Requests - HTTP PATCH Method - Python Examples
import requests response = requests.patch('/', data = {'apple':'25', 'banana':'33'}) print(response.headers) {'Content-Type': 'text/html; charset=UTF-8', 'Content-Length': '10600', 'Connection': 'keep-alive', 'Date': 'Thu, 11 May 2023 11:50:09 GMT', 'Server': 'Apache', 'Link': '</wp-json/>; rel="https://api.w.org/", </wp-json/wp/v2/pages/1>; rel="alternate"; type="application/json", </>; rel=shortlink', 'Vary': 'Accept-Encoding', 'Content-Encoding': 'gzip', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 093d516f7a216e2d93a34013516b0ba6.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'HYD50-C3', 'X-Amz-Cf-Id': '37kF4m9AG_MMAEqBeCXSF8ujZ5XZI1cBBI1OUQqAaUd3o3MvCBTrAg=='}
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ patch-method-python-requests
PATCH method - Python requests - GeeksforGeeks
April 28, 2025 - This means that the PATCH body ... PATCH is neither safe nor idempotent. Python's requests module provides in-built method called patch() for making a PATCH request to a specified URI....
๐ŸŒ
ProxiesAPI
proxiesapi.com โ€บ articles โ€บ making-partial-updates-with-patch-requests-in-python
Making Partial Updates with PATCH Requests in Python | ProxiesAPI
November 17, 2023 - ... Partial update: Only the changed attributes are sent, not the whole resource. This avoids overhead when making minor changes. Json patch documents: The PATCH request body contains JSON with update operations like "replace", "remove", etc.
๐ŸŒ
Python-requests
docs.python-requests.org โ€บ en โ€บ latest โ€บ api
Developer Interface โ€” Requests 2.33.1 documentation
json โ€“ (optional) A JSON serializable Python object to send in the body of the Request. **kwargs โ€“ Optional arguments that request takes. ... Sends a PATCH request.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ requests โ€บ requests_handling_post_put_patch_delete_requests.htm
Handling POST, PUT, PATCH and DELETE Requests
E:\prequests>python makeRequest.py {"args":{},"data":"","files":{},"form":{"name":"ABC","email":"xyz@gmail.com"}, "headers":{"x-forwarded-proto":"https","host":"postman-echo.com","content- length": "30","accept":"*/*","accept-encoding":"gzip, deflate","content- type":"applicatio n/x-www-form-urlencoded","user-agent":"python-requests/2.22.0","x-forwarded- port ":"443"},"json":{"name":"ABC","email":"xyz@gmail.com"}, "url":"https://postman-echo.com/put"} For the PATCH request, the Requests library has requests.patch() method, the example of it is shown below.
Find elsewhere
๐ŸŒ
Ramesh Fadatare
rameshfadatare.com โ€บ home โ€บ python requests.patch function
Python requests.patch Function - Ramesh Fadatare
July 26, 2024 - import requests url = ... totam\nnostrum rerum est autem sunt rem eveniet architecto'} The requests.patch function is a simple and effective way to make HTTP PATCH requests in Python....
๐ŸŒ
Codecademy
codecademy.com โ€บ docs โ€บ python โ€บ requests module โ€บ .patch()
Python | Requests Module | .patch() | Codecademy
August 27, 2025 - json: (optional) A JSON serializable Python object that will be sent as a JSON formatted string. kwargs: Additional keyword arguments that can be passed to the method (e.g. headers, auth, etc.). ... The method returns a Response object, which contains various information about the HTTP response returned by the server after processing the PATCH request.
๐ŸŒ
Real Python
realpython.com โ€บ python-requests
Python's Requests Library (Guide) โ€“ Real Python
July 23, 2025 - To add headers to requests, pass a dictionary of headers to the headers parameter in your request. To send POST data, use the data parameter for form-encoded data or the json parameter for JSON data.
๐ŸŒ
Codegive
codegive.com โ€บ blog โ€บ python_requests_patch_example.php
Python Requests PATCH Example (2026): The Secret to Seamless API Data Modification
Content Negotiation: While Content-Type specifies what you're sending, Accept headers specify what you expect to receive. For PATCH requests, you might still want to specify Accept: application/json or a specific API version. The requests.patch() method in Python is specifically for making ...
๐ŸŒ
Requests
requests.readthedocs.io โ€บ en โ€บ latest โ€บ api
Developer Interface โ€” Requests 2.33.1 documentation
json โ€“ (optional) A JSON serializable Python object to send in the body of the Request. **kwargs โ€“ Optional arguments that request takes. ... Sends a PATCH request.
๐ŸŒ
PyTutorial
pytutorial.com โ€บ python-requestspatch-guide-to-making-http-patch-requests
PyTutorial | Python requests.PATCH(): Guide to Making HTTP PATCH Requests
November 12, 2024 - import requests url = ... print(response.status_code) print(response.json()) You can include headers in your PATCH requests for authentication or content type specification....
๐ŸŒ
Codegive
codegive.com โ€บ blog โ€บ requests_patch_python.php
Unlock API Efficiency with <code>requests patch python</code> (2026): Your Guide to Smarter Data Updates and Fewer Headaches
January 15, 2026 - Most modern APIs expect JSON payloads for PATCH requests. The requests library has a convenient json parameter that automatically serializes your Python dictionary to JSON and sets the Content-Type header to application/json.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 65383503 โ€บ python-how-to-make-a-patch-request-to-an-api-with-requests
Python - How to make a PATCH request to an API with requests - Stack Overflow
I'm really new to python. I have done some research and found out about the requests module. I making the request ยท customerImported = requests.patch(f'https://somewebsite.io/api/v1/RefNum/20IOR011673', data={'Imported': 'yes'}) print(customerImported.json()) ... <?php $data = http_build_query( [ 'data' => [ ['name' => 'Scott', 'age' => 25] ] ] ); $options = array( 'http' => array( 'method' => 'PATCH', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $data ) ); $result = json_decode( file_get_contents('https://somewebsite.io/api/v1/id/61', false, stream_context_create($options)) );
๐ŸŒ
Airtable Community
community.airtable.com โ€บ home โ€บ ask the community โ€บ other questions โ€บ patch update request from python requests library won't work
PATCH update request from python requests library won't work | Airtable Community
November 20, 2020 - Found the solution: requests.patch(url, headers=hed, json=r2) N1 person likes this ยท Like ยท Powered by Gainsight ยท Terms & ConditionsAccessibility statement ยท Already have an account? Login ยท Log in with Airtable SSO ยท Log in with Airtable SSO ยท Enter your E-mail address.
๐ŸŒ
Codegive
codegive.com โ€บ blog โ€บ requests_patch.php
requests patch (2026): Master Partial API Updates & Boost Efficiency Today!
4 days ago - Use json= for JSON Payloads: This ... to send JSON data with requests, as it correctly serializes your Python dictionary and sets the Content-Type header. Set Timeouts: Prevent your application from hanging indefinitely on unresponsive servers by always specifying a timeout parameter.
๐ŸŒ
Linux Hint
linuxhint.com โ€บ python-requests-patch
Python Requests Patch
November 9, 2022 - Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
๐ŸŒ
Python-requests
2.python-requests.org โ€บ en โ€บ v1.1.0 โ€บ user โ€บ quickstart
Quickstart โ€” Requests 2.33.1 documentation
For example, the GitHub API v3 accepts JSON-Encoded POST/PATCH data: >>> import json >>> url = 'https://api.github.com/some/endpoint' >>> payload = {'some': 'data'} >>> r = requests.post(url, data=json.dumps(payload)) Please note that the above code will NOT add the Content-Type header (so in particular it will NOT set it to application/json).