I am trying to connect my mangodb database to a python project with this code
uri = "private information"
# 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)
I expected it to work beacouse this is the official code provided on the website but it returns
ac-pzt0xvv-shard-00-01.a6mprx6.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms),ac-pzt0xvv-shard-00-02.a6mprx6.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms),ac-pzt0xvv-shard-00-00.a6mprx6.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms), Timeout: 30s, Topology Description: <TopologyDescription id: 66903135831fe61abfdbd089, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-pzt0xvv-shard-00-00.a6mprx6.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-pzt0xvv-shard-00-00.a6mprx6.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)')>, <ServerDescription ('ac-pzt0xvv-shard-00-01.a6mprx6.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-pzt0xvv-shard-00-01.a6mprx6.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)')>, <ServerDescription ('ac-pzt0xvv-shard-00-02.a6mprx6.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-pzt0xvv-shard-00-02.a6mprx6.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)')>]>
error. Please help me.
New contributor
Oskar Klimala is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.