Browse Source

Set session `auth` to trivial function

Sets the session to not add "basic" auth if entry for keycloak host
exists in users `.netrc` (`requests` causes `Authorization: Basic ...`
header to be added if an entry exists in `.netrc` by default)

see: https://requests.readthedocs.io/en/master/api/#requests.Session.auth
pull/54/head
Josh Bode 5 years ago
parent
commit
8436dbc19d
  1. 1
      keycloak/connection.py

1
keycloak/connection.py

@ -47,6 +47,7 @@ class ConnectionManager(object):
self._timeout = timeout self._timeout = timeout
self._verify = verify self._verify = verify
self._s = requests.Session() self._s = requests.Session()
self._s.auth = lambda x: x # don't let requests add auth headers
# retry once to reset connection with Keycloak after tomcat's ConnectionTimeout # retry once to reset connection with Keycloak after tomcat's ConnectionTimeout
# see https://github.com/marcospereirampj/python-keycloak/issues/36 # see https://github.com/marcospereirampj/python-keycloak/issues/36

Loading…
Cancel
Save