From 8436dbc19d4b7de0f7557b4e5013f1730150b4fd Mon Sep 17 00:00:00 2001 From: Josh Bode Date: Thu, 16 Jan 2020 12:16:19 +1100 Subject: [PATCH] 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 --- keycloak/connection.py | 1 + 1 file changed, 1 insertion(+) diff --git a/keycloak/connection.py b/keycloak/connection.py index 6f32439..451082c 100644 --- a/keycloak/connection.py +++ b/keycloak/connection.py @@ -47,6 +47,7 @@ class ConnectionManager(object): self._timeout = timeout self._verify = verify 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 # see https://github.com/marcospereirampj/python-keycloak/issues/36