I have the following CURL syntax which I am trying to use by mimicking it in python requests:
curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/my_collection/update/json/docs' --data-binary '{"id": "1","title": "Doc 1"}'
I try it now using python requests:
import requests
import json
url = 'http://localhost:8983/solr/my_collection/update/json/docs'
payload = {"id": "1","title": "Doc 1"}
headers = {'Content-type': 'application/json'}
r = requests.post(url, data=json.dumps(payload), headers=headers)
print r.text
the request.post fails. I am wondering if I need to somehow include the --data-binary
flag in requests, but I am unsure.
Any help or pointers to the solution would be great.
Thanks.
EDIT
for r.text
, I get:
{"responseHeader":{"status":0,"QTime":5}}