|
@ -49,16 +49,16 @@ class ConnectionManager(object): |
|
|
self._s = requests.Session() |
|
|
self._s = requests.Session() |
|
|
self._s.auth = lambda x: x # don't let requests add auth headers |
|
|
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 |
|
|
|
|
|
for protocol in ('https://', 'http://'): |
|
|
|
|
|
adapter = HTTPAdapter(max_retries=1) |
|
|
|
|
|
# adds POST to retry whitelist |
|
|
|
|
|
allowed_methods = set(adapter.max_retries.allowed_methods) |
|
|
|
|
|
allowed_methods.add('POST') |
|
|
|
|
|
adapter.max_retries.allowed_methods = frozenset(allowed_methods) |
|
|
|
|
|
|
|
|
|
|
|
self._s.mount(protocol, adapter) |
|
|
|
|
|
|
|
|
# # retry once to reset connection with Keycloak after tomcat's ConnectionTimeout |
|
|
|
|
|
# # see https://github.com/marcospereirampj/python-keycloak/issues/36 |
|
|
|
|
|
# for protocol in ('https://', 'http://'): |
|
|
|
|
|
# adapter = HTTPAdapter(max_retries=1) |
|
|
|
|
|
# # adds POST to retry whitelist |
|
|
|
|
|
# allowed_methods = set(adapter.max_retries.allowed_methods) |
|
|
|
|
|
# allowed_methods.add('POST') |
|
|
|
|
|
# adapter.max_retries.allowed_methods = frozenset(allowed_methods) |
|
|
|
|
|
|
|
|
|
|
|
# self._s.mount(protocol, adapter) |
|
|
|
|
|
|
|
|
def __del__(self): |
|
|
def __del__(self): |
|
|
self._s.close() |
|
|
self._s.close() |
|
|