Traceback (most recent call last):
File "/Users/aarik/python/test.py", line 4, in <module>
cluster = MongoClient("mongodb+srv://aarik:<i already put in a password here>@cluster0.uyuc29f.mongodb.net/?retryWrites=true&w=majority")
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/mongo_client.py", line 677, in __init__
res = uri_parser.parse_uri(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/uri_parser.py", line 455, in parse_uri
raise ConfigurationError(
pymongo.errors.ConfigurationError: The "dnspython" module must be installed to use mongodb+srv:// URIs. To fix this error install pymongo with the srv extra:
/usr/local/bin/python3.10 -m pip install "pymongo[srv]"
➜ python -m pip install "pymongo[srv]"
zsh: command not found: -m
➜ python pip install "pymongo[srv]"
Requirement already satisfied: pymongo[srv] in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (4.1.1)
Collecting dnspython<3.0.0,>=1.16.0
Downloading dnspython-2.2.1-py3-none-any.whl (269 kB)
|████████████████████████████████| 269 kB 2.1 MB/s
Installing collected packages: dnspython
Successfully installed dnspython-2.2.1
➜ python /usr/local/bin/python3.10 /Users/aarik/python/test.py
Traceback (most recent call last):
File "/Users/aarik/python/test.py", line 4, in <module>
cluster = MongoClient("mongodb+srv://aarik:<already put in a password>@cluster0.uyuc29f.mongodb.net/?retryWrites=true&w=majority")
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/mongo_client.py", line 677, in __init__
res = uri_parser.parse_uri(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pymongo/uri_parser.py", line 455, in parse_uri
raise ConfigurationError(
pymongo.errors.ConfigurationError: The "dnspython" module must be installed to use mongodb+srv:// URIs. To fix this error install pymongo with the srv extra:
/usr/local/bin/python3.10 -m pip install "pymongo[srv]"
➜ python /usr/local/bin/python3.6 /Users/aarik/python/test.py
/usr/local/bin/python3.6 /Users/aarik/python/test.py
/usr/local/bin/python3.6 /Users/aarik/python/test.py
Traceback (most recent call last):
File "/Users/aarik/python/test.py", line 10, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymongo/collection.py", line 613, in insert_one
comment=comment,
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymongo/collection.py", line 547, in _insert_one
self.__database.client._retryable_write(acknowledged, _insert_command, session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1398, in _retryable_write
with self._tmp_session(session) as s:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 81, in __enter__
return next(self.gen)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1676, in _tmp_session
s = self._ensure_session(session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1663, in _ensure_session
return self.__start_session(True, causal_consistency=False)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1608, in __start_session
self._topology._check_implicit_session_support()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymongo/topology.py", line 519, in _check_implicit_session_support
self._check_session_support()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymongo/topology.py", line 536, in _check_session_support
readable_server_selector, self._settings.server_selection_timeout, None
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pymongo/topology.py", line 229, in _select_servers_loop
% (self._error_message(selector), timeout, self.description)
pymongo.errors.ServerSelectionTimeoutError: SSL handshake failed: ac-oucby4l-shard-00-02.uyuc29f.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852),SSL handshake failed: ac-oucby4l-shard-00-01.uyuc29f.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852),SSL handshake failed: ac-oucby4l-shard-00-00.uyuc29f.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852), Timeout: 30s, Topology Description: <TopologyDescription id: 631e0275062c9e52d5465ad0, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-oucby4l-shard-00-00.uyuc29f.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('SSL handshake failed: ac-oucby4l-shard-00-00.uyuc29f.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)',)>, <ServerDescription ('ac-oucby4l-shard-00-01.uyuc29f.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('SSL handshake failed: ac-oucby4l-shard-00-01.uyuc29f.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)',)>, <ServerDescription ('ac-oucby4l-shard-00-02.uyuc29f.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('SSL handshake failed: ac-oucby4l-shard-00-02.uyuc29f.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)',)>]>
how can i fix this