mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

Username and password must be escaped according to RFC 3986, use urllib.parse.quote_plus().

Open JDRanpariya opened this issue 4 years ago • 2 comments

Hi there, my python code is

user = urllib.parse.quote_plus(os.getenv("USER"))
passwd = urllib.parse.quote_plus(os.getenv("PASS"))

connect(os.getenv("MONGO_DATABASE"), host= "mongodb+srv://%s:%s@[email protected]/%s?retryWrites=true&w=majority" % (user, passwd, os.getenv("MONGO_DATABASE")))

I'm using urllib.parse.quote_plus() still getting the following issue

raise InvalidURI("Username and password must be escaped according to "
pymongo.errors.InvalidURI: Username and password must be escaped according to RFC 3986, use urllib.parse.quote_plus().

JDRanpariya avatar Feb 05 '21 10:02 JDRanpariya

Hope this will help you! https://www.wtsol.org/2021/01/31/djangopythonwebsitewithadmin/ https://stackoverflow.com/questions/39237813/how-to-escape-in-a-password-in-pymongo-connection

ghost avatar Mar 27 '21 18:03 ghost

Thank you @Altaf12sees ..

https://stackoverflow.com/questions/39237813/how-to-escape-in-a-password-in-pymongo-connection

this helped...

Sathipoo avatar Jun 09 '22 17:06 Sathipoo