Home > Blockchain >  Mongodb ssl certificate error in python, how can i fix the error?
Mongodb ssl certificate error in python, how can i fix the error?

Time:09-30

When i try to do actions on my shared mongodb i get this error while developing in python, how can i fix this ?

<ServerDescription ('cluster0xxxxmongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0xxxxmongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)')>

CodePudding user response:

First install certifi

pip install certifi

Then use it in code:

import certifi
client = pymongo.MongoClient(f"mongodb srv://username:[email protected]/db?retryWrites=true&w=majority",tlsCAFile=certifi.where())
  • Related