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

MongoClient(ssl=True, tls=False) fails with an AttributeError

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 3.12, 4.0
    • Affects Version/s: None
    • Component/s: None

      MongoClient(ssl=True, tls=False) fails with an AttributeError:

      >>> MongoClient(ssl=True, tls=False)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/Users/shane/git/mongo-python-driver/pymongo/mongo_client.py", line 672, in __init__
          opts = _handle_security_options(opts)
        File "/Users/shane/git/mongo-python-driver/pymongo/uri_parser.py", line 217, in _handle_security_options
          options.cased_key('ssl'), options.cased_key('tls')))
      AttributeError: 'dict' object has no attribute 'cased_key'
      

      The expected behavior should be the same as this:

      >>> MongoClient('mongodb://localhost/?ssl=true&tls=false')
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/Users/shane/git/mongo-python-driver/pymongo/mongo_client.py", line 639, in __init__
          res = uri_parser.parse_uri(
        File "/Users/shane/git/mongo-python-driver/pymongo/uri_parser.py", line 466, in parse_uri
          options.update(split_options(opts, validate, warn, normalize))
        File "/Users/shane/git/mongo-python-driver/pymongo/uri_parser.py", line 326, in split_options
          options = _handle_security_options(options)
        File "/Users/shane/git/mongo-python-driver/pymongo/uri_parser.py", line 216, in _handle_security_options
          raise InvalidURI(err_msg % (
      pymongo.errors.InvalidURI: Can not specify conflicting values for URI options ssl and tls.
      

            Assignee:
            william.zhou@mongodb.com William Zhou
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: