i am getting this error while connecting to mongodb Atlas: "dns.exception.Timeout: The DNS operation timed out after 30.000985383987427 seconds"
Try using a different connection string. I was having problems with the 3.6 or later string. Simply used the 3.4 or later string and it connected instantly.
if you insist on using a newer connection string, you need to install pymongo srv
For Windows
pip install pymongo[srv]
For Mac
pip3 install pymongo[srv]
On zsh
pip3 install 'pymongo[srv]'