Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-3800

An error occurs when the SRV record contains uppercase letters.

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.5, 4.4.1
    • Affects Version/s: 4.4
    • Component/s: None
    • None

      Detailed steps to reproduce the problem?

       

      python3 main.py      
      Traceback (most recent call last):
        File "/Users/user/Workspace/tmp/pymongo-test/main.py", line 11, in <module>
          client = pymongo.MongoClient(uri)
                   ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/user/Workspace/tmp/pymongo-test/venv/lib/python3.11/site-packages/pymongo/mongo_client.py", line 748, in _init_
          res = uri_parser.parse_uri(
                ^^^^^^^^^^^^^^^^^^^^^
        File "/Users/user/Workspace/tmp/pymongo-test/venv/lib/python3.11/site-packages/pymongo/uri_parser.py", line 539, in parse_uri
          nodes = dns_resolver.get_hosts()
                  ^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/user/Workspace/tmp/pymongo-test/venv/lib/python3.11/site-packages/pymongo/srv_resolver.py", line 121, in get_hosts
          _, nodes = self._get_srv_response_and_hosts(True)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/user/Workspace/tmp/pymongo-test/venv/lib/python3.11/site-packages/pymongo/srv_resolver.py", line 115, in _get_srv_response_and_hosts
          raise ConfigurationError(f"Invalid SRV host: {node[0]}")
      pymongo.errors.ConfigurationError: Invalid SRV host: mongodb-r.jeongmu-rs-b001.mdev-RegionOne.mg.db.***.com

      The exact Python version used, with patch level:

      $ python -c "import sys; print(sys.version)"

      3.11.4 (main, Jun 15 2023, 07:55:38) [Clang 14.0.3 (clang-1403.0.22.14.1)]

      The exact version of PyMongo used, with patch level:

      $ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"

      4.4.0
      True

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      macOS 13.4.1(22F82)

      Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)

      Nothing

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            qkr112099@gmail.com 정무 박
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: