@@ -606,59 +606,6 @@ def _lookup_uri(
606606 srv_service_name : Optional [str ] = None ,
607607 srv_max_hosts : Optional [int ] = None ,
608608) -> dict [str , Any ]:
609- """Parse and validate a MongoDB URI.
610-
611- Returns a dict of the form::
612-
613- {
614- 'nodelist': <list of (host, port) tuples>,
615- 'username': <username> or None,
616- 'password': <password> or None,
617- 'database': <database name> or None,
618- 'collection': <collection name> or None,
619- 'options': <dict of MongoDB URI options>,
620- 'fqdn': <fqdn of the MongoDB+SRV URI> or None
621- }
622-
623- If the URI scheme is "mongodb+srv://" DNS SRV and TXT lookups will be done
624- to build nodelist and options.
625-
626- :param uri: The MongoDB URI to parse.
627- :param default_port: The port number to use when one wasn't specified
628- for a host in the URI.
629- :param validate: If ``True`` (the default), validate and
630- normalize all options. Default: ``True``.
631- :param warn: When validating, if ``True`` then will warn
632- the user then ignore any invalid options or values. If ``False``,
633- validation will error when options are unsupported or values are
634- invalid. Default: ``False``.
635- :param normalize: If ``True``, convert names of URI options
636- to their internally-used names. Default: ``True``.
637- :param connect_timeout: The maximum time in milliseconds to
638- wait for a response from the DNS server.
639- :param srv_service_name: A custom SRV service name
640-
641- .. versionchanged:: 4.6
642- The delimiting slash (``/``) between hosts and connection options is now optional.
643- For example, "mongodb://example.com?tls=true" is now a valid URI.
644-
645- .. versionchanged:: 4.0
646- To better follow RFC 3986, unquoted percent signs ("%") are no longer
647- supported.
648-
649- .. versionchanged:: 3.9
650- Added the ``normalize`` parameter.
651-
652- .. versionchanged:: 3.6
653- Added support for mongodb+srv:// URIs.
654-
655- .. versionchanged:: 3.5
656- Return the original value of the ``readPreference`` MongoDB URI option
657- instead of the validated read preference mode.
658-
659- .. versionchanged:: 3.1
660- ``warn`` added so invalid options can be ignored.
661- """
662609 if uri .startswith (SCHEME ):
663610 is_srv = False
664611 scheme_free = uri [SCHEME_LEN :]
0 commit comments