Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic authentication added #147

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions pysolr.py
Expand Up @@ -251,9 +251,10 @@ class Solr(object):
solr = pysolr.Solr('http://localhost:8983/solr', timeout=10)

"""
def __init__(self, url, decoder=None, timeout=60):
def __init__(self, url, decoder=None, timeout=60, auth=None):
self.decoder = decoder or json.JSONDecoder()
self.url = url
self.auth = auth
self.timeout = timeout
self.log = self._get_log()
self.session = requests.Session()
Expand Down Expand Up @@ -300,7 +301,7 @@ def _send_request(self, method, path='', body=None, headers=None, files=None):
bytes_body = force_bytes(body)

resp = requests_method(url, data=bytes_body, headers=headers, files=files,
timeout=self.timeout)
timeout=self.timeout, auth=self.auth)
except requests.exceptions.Timeout as err:
error_message = "Connection to server '%s' timed out: %s"
self.log.error(error_message, url, err, exc_info=True)
Expand Down