File tree Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Original file line number Diff line number Diff line change 33from typing import List
44from pydantic import BaseModel
55import motor .motor_asyncio
6- from urllib .parse import quote_plus
76
87app = FastAPI (
98 title = "Fastapi and mongodb demo API" ,
2019print (f"mongodb_user : { mongodb_user } " )
2120print (f"mongodb_password : { mongodb_password } " )
2221
23- # Encode username & password
24- encoded_user = quote_plus (mongodb_user )
25- encoded_password = quote_plus (mongodb_password )
26-
2722# Construct the MongoDB URI
2823if "@" in raw_mongodb_url :
2924 # If DB_URL already contains credentials, use it as is
3025 mongodb_url = raw_mongodb_url
3126else :
32- mongodb_url = f"mongodb://{ encoded_user } :{ encoded_password } @{ raw_mongodb_url .split ('mongodb://' )[1 ]} "
27+ mongodb_url = f"mongodb://{ mongodb_user } :{ mongodb_password } @{ raw_mongodb_url .split ('mongodb://' )[1 ]} "
3328
3429print (f"Using MongoDB URL: { mongodb_url } " )
3530
You can’t perform that action at this time.
0 commit comments