Compare commits

...

4 Commits

  1. 4
      Pipfile
  2. 22
      keycloak/connection.py
  3. 6
      requirements.txt

4
Pipfile

@ -4,9 +4,9 @@ verify_ssl = true
name = "pypi"
[packages]
requests = ">=2.20.0"
requests = ">=2.25.0"
httmock = ">=1.2.5"
python-jose = ">=1.4.0"
python-jose = ">=3.2.0"
[dev-packages]

22
keycloak/connection.py

@ -49,16 +49,18 @@ class ConnectionManager(object):
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
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)
self._s.get(self.base_url)
# # 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):
self._s.close()

6
requirements.txt

@ -1,6 +1,6 @@
requests>=2.20.0
requests>=2.25.0
httmock>=1.2.5
python-jose>=1.4.0
python-jose>=3.2.0
twine==1.13.0
jose~=1.0.0
setuptools~=54.2.0
setuptools~=54.2.0
Loading…
Cancel
Save