Closed ItsMitlit closed 12 months ago
Remove everything after ? From your string
Remove everything after ? From your string
Now it says pymongo.errors.InvalidURI: Username and password must be escaped according to RFC 3986, use urllib.parse.quote_plus().
Remove the qoutes it needs to be like this user:pass
Remove the qoutes it needs to be like this user:pass
In the MONGO_URI
string?
Yes
Yes
I don't see any quotes?
mongodb+srv://example:examplepw@cluster0.example.mongodb.net/?
Weird
Normally it should work
File "/home/container/Start.py", line 42, in <module> mongo = PyMongo(app) ^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/flask_pymongo/__init__.py", line 110, in __init__ self.init_app(app, uri, *args, **kwargs) File "/home/container/.local/lib/python3.11/site-packages/flask_pymongo/__init__.py", line 147, in init_app parsed_uri = uri_parser.parse_uri(uri) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/pymongo/uri_parser.py", line 470, in parse_uri user, passwd = parse_userinfo(userinfo) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/pymongo/uri_parser.py", line 60, in parse_userinfo 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().
Fixed it.
Whenever I attempt to run
Start.py
i get the error:File "/home/container/Start.py", line 42, in <module> mongo = PyMongo(app) ^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/flask_pymongo/__init__.py", line 110, in __init__ self.init_app(app, uri, *args, **kwargs) File "/home/container/.local/lib/python3.11/site-packages/flask_pymongo/__init__.py", line 147, in init_app parsed_uri = uri_parser.parse_uri(uri) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/pymongo/uri_parser.py", line 532, in parse_uri user, passwd = parse_userinfo(userinfo) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/pymongo/uri_parser.py", line 88, in parse_userinfo raise InvalidURI( pymongo.errors.InvalidURI: Username and password must be escaped according to RFC 3986, use urllib.parse.quote_plus
my MONGO_URI is
mongodb+srv://example:examplepw@cluster0.example.mongodb.net/?retryWrites=true&w=majority