Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions pymongo/asynchronous/srv_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import random
from typing import TYPE_CHECKING, Any, Optional, Union

from pymongo.common import CONNECT_TIMEOUT, check_for_min_version
from pymongo.common import CONNECT_TIMEOUT
from pymongo.errors import ConfigurationError

if TYPE_CHECKING:
Expand All @@ -32,14 +32,6 @@ def _have_dnspython() -> bool:
try:
import dns # noqa: F401

dns_version, required_version, is_valid = check_for_min_version("dnspython")
if not is_valid:
raise RuntimeError(
f"pymongo requires dnspython>={required_version}, "
f"found version {dns_version}. "
"Install a compatible version with pip"
)

return True
except ImportError:
return False
Expand Down Expand Up @@ -79,8 +71,6 @@ def __init__(
srv_service_name: str,
srv_max_hosts: int = 0,
):
# Ensure the version of dnspython is compatible.
_have_dnspython()
self.__fqdn = fqdn
self.__srv = srv_service_name
self.__connect_timeout = connect_timeout or CONNECT_TIMEOUT
Expand Down
12 changes: 1 addition & 11 deletions pymongo/synchronous/srv_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import random
from typing import TYPE_CHECKING, Any, Optional, Union

from pymongo.common import CONNECT_TIMEOUT, check_for_min_version
from pymongo.common import CONNECT_TIMEOUT
from pymongo.errors import ConfigurationError

if TYPE_CHECKING:
Expand All @@ -32,14 +32,6 @@ def _have_dnspython() -> bool:
try:
import dns # noqa: F401

dns_version, required_version, is_valid = check_for_min_version("dnspython")
if not is_valid:
raise RuntimeError(
f"pymongo requires dnspython>={required_version}, "
f"found version {dns_version}. "
"Install a compatible version with pip"
)

return True
except ImportError:
return False
Expand Down Expand Up @@ -79,8 +71,6 @@ def __init__(
srv_service_name: str,
srv_max_hosts: int = 0,
):
# Ensure the version of dnspython is compatible.
_have_dnspython()
self.__fqdn = fqdn
self.__srv = srv_service_name
self.__connect_timeout = connect_timeout or CONNECT_TIMEOUT
Expand Down
Loading