Question

I'm looking to PUT data to the Pipeline Deals API in Python with Requests, and though I get a Response 200, the data does not actually successfully PUT. When I make the exact same request with cURL, it does. Here's the Python code that doesn't work:

param = {'api_key': 'MY API KEY'}
url = "https://api.pipelinedeals.com/api/v3/companies/14634816.json"
r = requests.put(url, params=param, data="company[name]=Python")
print r
--> <Response [200]>

When I run this cURL code, it works:

curl --X PUT -d "company[name]=cURL" \
"https://api.pipelinedeals.com/api/v3/companies/14634816.json?api_key=SAME_API_KEY"

Am I missing something? Or is it possible I'm hitting a bug in the Requests library, such as around https?

Thanks!

Était-ce utile?

La solution

Change a bit into the URL:

url = "https://api.pipelinedeals.com/api/v3/companies/14634816.json?api_key=MY_API_KEY"

And then the params:

param = {"company[name]":"Python"}

Now to the PUT

r = requests.put(url, data=param)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top