leschweitzer / solrpy

Automatically exported from code.google.com/p/solrpy
0 stars 0 forks source link

post_header does not work when I use s.query() #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

>>> import solr
>>> s = solr.SolrConnection('https://example.com/solr', 
post_headers={'x-api-key': 'xxxyyyzzz'})
>>> s.query("fred")

What is the expected output? What do you see instead?

I expect to see the x-api-key header on the server side

What version of the product are you using? On what operating system?
`pip install solrpy` version on OS X

Please provide any additional information below.

here is a patch that fixes it for me

https://code.google.com/r/briantinglecdliborg-solrpyx/source/detail?r=d83b854e3b
301aa1f433e52c7c5e617c1b4b303e

diff -r a1df185049b5 solr/core.py
--- a/solr/core.py  Tue Dec 03 16:34:22 2013 -0500
+++ b/solr/core.py  Fri Jan 16 20:28:19 2015 -0800
@@ -419,6 +419,7 @@

         self.form_headers = {
             'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'}
+        self.form_headers.update(post_headers)

         if http_user is not None and http_pass is not None:
             http_auth = http_user + ':' + http_pass

Original issue reported on code.google.com by brian.ti...@gmail.com on 17 Jan 2015 at 4:39