tuba8890 / AccountGen

GNU General Public License v3.0
4 stars 1 forks source link

[SOLVED] Unable to start due to MongoDB | Password contained "@" #7

Closed ItsMitlit closed 12 months ago

ItsMitlit commented 12 months ago

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

Marsi591 commented 12 months ago

Remove everything after ? From your string

ItsMitlit commented 12 months ago

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().

Marsi591 commented 12 months ago

Remove the qoutes it needs to be like this user:pass

ItsMitlit commented 12 months ago

Remove the qoutes it needs to be like this user:pass

In the MONGO_URI string?

Marsi591 commented 12 months ago

Yes

ItsMitlit commented 12 months ago

Yes

I don't see any quotes? mongodb+srv://example:examplepw@cluster0.example.mongodb.net/?

Marsi591 commented 12 months ago

Weird

Marsi591 commented 12 months ago

Normally it should work

ItsMitlit commented 12 months ago

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().

ItsMitlit commented 12 months ago

Fixed it.