MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / get_options

Method get_options

pymongo/asynchronous/srv_resolver.py:92–104  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

90 self.nparts = len(split_fqdn)
91
92 async def get_options(self) -> Optional[str]:
93 from dns import resolver
94
95 try:
96 results = await _resolve(self.__fqdn, "TXT", lifetime=self.__connect_timeout)
97 except (resolver.NoAnswer, resolver.NXDOMAIN):
98 # No TXT records
99 return None
100 except Exception as exc:
101 raise ConfigurationError(str(exc)) from exc
102 if len(results) > 1:
103 raise ConfigurationError("Only one TXT record is supported")
104 return (b"&".join([b"".join(res.strings) for res in results])).decode("utf-8") # type: ignore[attr-defined]
105
106 async def _resolve_uri(self, encapsulate_errors: bool) -> resolver.Answer:
107 try:

Callers 1

_parse_srvFunction · 0.45

Calls 4

ConfigurationErrorClass · 0.90
decodeMethod · 0.80
_resolveFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected