I am having some issues connecting to my database on MongoDB. I am using mongoengine library to connect to the DB. I am also using ATLAS. Whenever I try to run my project it keeps showing “Exception has occurred: ServerSelectionTimeoutError” then show [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
from enum import unique from json import dumps from mongoengine import * from datetime import datetime import json import os db_uri = "My link would go in here" connect(host=db_uri) class Artists(DynamicDocument): artistName = StringField() artistEarning = FloatField() artistAlbumn = IntField() dateAdded = DateTimeField(default=datetime.utcnow()) def json(self): artist = { "Artist": self.artistName, "Artist Earnings": self.artistEarning, "Amount of Albums": self.artistAlbumn, "Info Added": self.dateAdded } return json.dumps(artist) artists = Artists( artistName="Post Malone", artistEarning=20000.00, artistAlbumn=20 ).save() print('Data Saved')
If anyone could assist me? Or any tips?
Thanks,
Spendy
Advertisement
Answer
Sorry I figured it out.
If anyone else is facing this issue of the SSL error. You need to go to your directory where Python is installed and double click on the “Install Certificates.command” once this is done the issue went away.
Thanks,
Spendy