Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a PATCH request in Python?

Tags:

Is there a way to make a request using the PATCH HTTP method in Python?

I tried using httplib, but it doesn't accept PATCH as method param.

like image 759
Ricardo Augusto Avatar asked Jul 28 '11 01:07

Ricardo Augusto


People also ask

How do I apply a PATCH request in Python?

How to make Patch request through Python Requests. Python's requests module provides in-built method called patch() for making a PATCH request to a specified URI.

How do you send a request in Python?

To create a POST request in Python, use the requests. post() method. The requests post() method accepts URL. data, json, and args as arguments and sends a POST request to a specified URL.

How do you send a header request in Python?

You'll want to adapt the data you send in the body of your request to the specified URL. Syntax: requests. post(url, data={key: value}, json={key: value}, headers={key:value}, args) *(data, json, headers parameters are optional.)


1 Answers

With Requests, making PATCH requests is very simple:

import requests  r = requests.patch('http://httpbin.org/patch') 
like image 187
Kenneth Reitz Avatar answered Dec 12 '22 09:12

Kenneth Reitz