Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions infoblox_client/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import six
import urllib3
import time
import base64
from requests import exceptions as req_exc

try:
Expand Down Expand Up @@ -196,8 +197,9 @@ def _configure_session(self):
self.session.mount('http://', adapter)
self.session.mount('https://', adapter)
if hasattr(self, 'username') and hasattr(self, 'password'):
LOG.info("Authenticating with username and password.")
self.session.auth = (self.username, self.password)
auth_str = f"{self.username}:{self.password}"
encoded_auth = base64.b64encode(auth_str.encode('utf-8')).decode('utf-8')
self.session.headers.update({'Authorization': f'Basic {encoded_auth}'})
else:
self.session.cert = (self.cert, self.key)
LOG.info("Authenticating with client certificate.")
Expand Down