
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
pymongo, dnspython 패키지 설치되어있고,
강의데로 한것 같은데 에러가 납니다..
어떻게 해결해야 할까요?
? 앞에 클러스터 이름도 넣어봤고 클러스터를 지우고 다시 만들어도 같은 에러가 나옵니다..


작성한 코드 및 에러 메세지
from pymongo import MongoClient
client = MongoClient('mongodb+srv://hab:863086@cluster0.rwfjkjt.mongodb.net/?retryWrites=true&w=majority')
db = client.dbsparta
doc = {
'name' : 'bab',
'age' : '27'
}
db.users.insert_one(doc)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C:\Users\user\Desktop\han\frontend\pythonprac\venv\Scripts\python.exe C:\Users\user\Desktop\han\frontend\pythonprac\dbprack.py
Traceback (most recent call last):
File "C:\Users\user\Desktop\han\frontend\pythonprac\dbprack.py", line 10, in <module>
db.users.insert_one(doc)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\collection.py", line 628, in insert_one
comment=comment,
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\collection.py", line 562, in _insert_one
self.__database.client._retryable_write(acknowledged, _insert_command, session)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\mongo_client.py", line 1476, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\mongo_client.py", line 1349, in _retry_with_session
return self._retry_internal(retryable, func, session, bulk)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\mongo_client.py", line 1381, in _retry_internal
with self._get_socket(server, session) as sock_info:
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\mongo_client.py", line 1217, in _get_socket
with server.get_socket(handler=err_handler) as sock_info:
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\pool.py", line 1407, in get_socket
sock_info = self._get_socket(handler=handler)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\pool.py", line 1520, in _get_socket
sock_info = self.connect(handler=handler)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\pool.py", line 1378, in connect
sock_info.authenticate()
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\pool.py", line 870, in authenticate
auth.authenticate(creds, self)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\auth.py", line 549, in authenticate
auth_func(credentials, sock_info)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\auth.py", line 475, in _authenticate_default
return _authenticate_scram(credentials, sock_info, "SCRAM-SHA-1")
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\auth.py", line 241, in _authenticate_scram
res = sock_info.command(source, cmd)
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\pool.py", line 789, in command
write_concern=write_concern,
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\network.py", line 170, in command
parse_write_concern_error=parse_write_concern_error,
File "C:\Users\user\Desktop\han\frontend\pythonprac\venv\lib\site-packages\pymongo\helpers.py", line 181, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: bad auth : Authentication failed., full error: {'ok': 0, 'errmsg': 'bad auth : Authentication failed.', 'code': 8000, 'codeName': 'AtlasError'}
종료 코드 1(으)로 완료된 프로세스
