Pymongo SSL authentication errors

Hello,
I am having issues authenticating with the atlas cluster using pymongo. I can connect to it via the shell, and via the vs code extension.

My system:
Windows 10
VS Code IDE
Using conda

my pip freeze gives the following:

certifi==2021.5.30
dnspython==2.1.0
pymongo==3.12.0
wincertstore==0.2

the python code I am trying to run is:

import pymongo

cluster = pymongo.MongoClient(“mongodb+srv://dorea:mypassword@tyche.tndz8.mongodb.net/test?retryWrites=true&w=majority”)
db = cluster[‘test’]
col = db[‘test’]
doc = {“_id”:0, “name”:‘Alex’, “score”:100}
col.insert_one(doc)

The error I am getting is:>

pymongo.errors.ServerSelectionTimeoutError: SSL handshake failed: <removed link due to new account and # of links issue>: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852),SSL handshake failed: tyche-shard-00-00.tndz8.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852),SSL handshake failed:
<removed link due to new account and # of links issue: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852), Timeout: 30s, Topology Description: <TopologyDescription id: 60facbadcb36ab4cb6d884cb, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription (‘<removed link due to new account and # of links issue’, 27017) server_type: Unknown, rtt: None, error=AutoReconnect(‘SSL handshake failed: <removed link due to new account and # of links issue: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)’,)>, <ServerDescription (‘<removed link due to new account and # of links issue, 27017) server_type: Unknown, rtt: None, error=AutoReconnect(‘SSL handshake failed: <removed link due to new account and # of links issue: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)’,)>, <ServerDescription (<removed link due to new account and # of links issue’, 27017) server_type: Unknown, rtt: None, error=AutoReconnect(‘SSL handshake failed: tyche-shard-00-02.tndz8.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)’,)>]>

I’ve seen many posts here with this error and many on StackOverflow, but it seems they all relate to MacOS or Linux. I’ve tried a few of the things in there, but I cannot get this to work.

Any help would be appreciated.

To add to the confusion:

I have installed WSL and conda on it.

I pip installed pymongo and dnspython and the same python code runs fine and the atlas collection gets a new request…