Python drivers connection to Atlas

Hi, To connect to Atlas using python, I installed the !python -m pip install “pymongo[srv]”
And the I used the following code suggested by Atlas . However, it refuses the connection. I pasted the message below. I appreciate it if you could help me with this issue. thanks
from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi

uri = “mongodb+srv://MYUSERNAME:XXXX@cluster0.vz5y0.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0”

Create a new client and connect to the server

client = MongoClient(uri, server_api=ServerApi(‘1’))

Send a ping to confirm a successful connection

try:
client.admin.command(‘ping’)
print(“Pinged your deployment. You successfully connected to MongoDB!”)
except Exception as e:
print(e)

SSL handshake failed: cluster0-shard-00-02.vz5y0.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms),SSL handshake failed: cluster0-shard-00-01.vz5y0.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms),SSL handshake failed: cluster0-shard-00-00.vz5y0.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms), Timeout: 30s, Topology Description: <TopologyDescription id: 67316f8c7e38fefd89da29c9, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription (‘cluster0-shard-00-00.vz5y0.mongodb.net’, 27017) server_type: Unknown, rtt: None, error=AutoReconnect(‘SSL handshake failed: cluster0-shard-00-00.vz5y0.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)’)>, <ServerDescription (‘cluster0-shard-00-01.vz5y0.mongodb.net’, 27017) server_type: Unknown, rtt: None, error=AutoReconnect(‘SSL handshake failed: cluster0-shard-00-01.vz5y0.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)’)>, <ServerDescription (‘cluster0-shard-00-02.vz5y0.mongodb.net’, 27017) server_type: Unknown, rtt: None, error=AutoReconnect(‘SSL handshake failed: cluster0-shard-00-02.vz5y0.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1007) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)’)>]>


Sounds like the connection is timing out, possibly because you’re firewalled out on your side.