RE: Problem with POST in python code

2024-12-17 Thread Macfarlane, Andrew
Andrew Thank you, that resolves the POSTing problem. I'm getting an error on the query, but I'll try and resolve that myself! Cheers Andy -Original Message- From: Andrew Hankinson Sent: 17 December 2024 10:23 To: users@solr.apache.org Subject: Re: Problem with POST in p

Re: Problem with POST in python code

2024-12-17 Thread ufuk yılmaz
I think your code sends query json as application/x-www-form-urlencoded and not as json in the post request body. In the first case the query should be in q parameter as non-json similar to a get request. If you want to use the json query api then content type must be application/json -ufuk —

Re: Problem with POST in python code

2024-12-17 Thread Andrew Hankinson
You're not actually POSTing the data. The requests module is a lot easier than using the urllib module. https://requests.readthedocs.io/en/latest/ r = requests.post('http://localhost:8983/solr/films/query', data={"query":"*:*"}) print(r.json()) This should set all the appropriate headers as w