我在連接 MongoDB 上的數(shù)據(jù)庫(kù)時(shí)遇到一些問(wèn)題。我正在使用 mongoengine 庫(kù)連接到數(shù)據(jù)庫(kù)。我也在用ATLAS。每當(dāng)我嘗試運(yùn)行我的項(xiàng)目時(shí),它都會(huì)顯示“發(fā)生異常:ServerSelectionTimeoutError”,然后顯示 [SSL: CERTIFICATE_VERIFY_FAILED] 證書驗(yàn)證失?。簾o(wú)法獲取本地頒發(fā)者證書from enum import uniquefrom json import dumpsfrom mongoengine import *from datetime import datetimeimport jsonimport osdb_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')如果有人可以幫助我嗎?或者有什么建議嗎?
1 回答

慕萊塢森
TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊
抱歉我想通了。
如果其他人遇到 SSL 錯(cuò)誤的問(wèn)題。您需要轉(zhuǎn)到安裝 Python 的目錄,然后雙擊“Install Certificates.command”,完成此操作后問(wèn)題就消失了。
添加回答
舉報(bào)
0/150
提交
取消