diff --git a/django_redis/pool.py b/django_redis/pool.py index 20817992..402d8797 100644 --- a/django_redis/pool.py +++ b/django_redis/pool.py @@ -1,5 +1,5 @@ from typing import Dict -from urllib.parse import parse_qs, urlparse,urlencode,urlunparse +from urllib.parse import parse_qs, urlencode, urlparse, urlunparse from django.conf import settings from django.core.exceptions import ImproperlyConfigured @@ -168,23 +168,20 @@ def get_connection_pool(self, params): query_params = parse_qs(url.query) is_master = query_params.get("is_master") if is_master: - cp_params['is_master'] = to_bool(is_master[0]) + cp_params["is_master"] = to_bool(is_master[0]) # then remove the "is_master" query string from the URL # so it doesn't interfere with the SentinelConnectionPool constructor - if 'is_master' in query_params: - del query_params['is_master'] + if "is_master" in query_params: + del query_params["is_master"] new_query = urlencode(query_params, doseq=True) - new_url = urlunparse(( - url.scheme, - url.netloc, - url.path, - url.params, - new_query, - url.fragment - )) + new_url = urlunparse( + (url.scheme, url.netloc, url.path, url.params, new_query, url.fragment) + ) - cp_params.update(service_name=url.hostname, sentinel_manager=self._sentinel,url=new_url) + cp_params.update( + service_name=url.hostname, sentinel_manager=self._sentinel, url=new_url + ) pool = super().get_connection_pool(cp_params) return pool