Skip to content

Commit

Permalink
Merge pull request #35 from gclm/main
Browse files Browse the repository at this point in the history
fix: 修复含有特殊字符密码链接失败
  • Loading branch information
howie6879 authored Jan 28, 2022
2 parents 71179a2 + 9222a98 commit 7f31d8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/databases/mongodb_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pymongo import MongoClient

from src.utils.tools import md5_encryption
from urllib import parse


class MongodbBase:
Expand All @@ -22,8 +23,8 @@ def __init__(self, mongodb_config: dict):
self.mongodb_config = mongodb_config
self.mongodb_uri = "mongodb://{account}{host}:{port}/{db}".format(
account="{username}:{password}@".format(
username=self.mongodb_config["username"],
password=self.mongodb_config["password"],
username=parse.quote_plus(self.mongodb_config["username"]),
password=parse.quote_plus(self.mongodb_config["password"])
)
if self.mongodb_config.get("username")
else "",
Expand Down

0 comments on commit 7f31d8f

Please sign in to comment.