I keep getting
pymongo.errors.ConfigurationError: query() got an unexpected keyword argument 'lifetime'
even though I have all the latest versions of pymongo and dnspython installed.
This is my code...
import pymongo
client = pymongo.MongoClient("mongodb+srv://Nethrenial:[email protected]/TooDooo?retryWrites=true&w=majority")
users = client.users.find()
user_list = []
for user in users:
user_list.append(user)
print(user_list)
And this is the complete exception,
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\srv_resolver.py", line 72, in _resolve_uri
results = resolver.query('_mongodb._tcp.' + self.__fqdn, 'SRV',
TypeError: query() got an unexpected keyword argument 'lifetime'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\TooDooo\database_functions.py", line 4, in <module>
client = pymongo.MongoClient("mongodb+srv://Nethrenial:[email protected]/TooDooo?retryWrites=true&w=majority")
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\mongo_client.py", line 639, in __init__
res = uri_parser.parse_uri(
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\uri_parser.py", line 500, in parse_uri
nodes = dns_resolver.get_hosts()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\srv_resolver.py", line 102, in get_hosts
_, nodes = self._get_srv_response_and_hosts(True)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\srv_resolver.py", line 83, in _get_srv_response_and_hosts
results = self._resolve_uri(encapsulate_errors)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\srv_resolver.py", line 79, in _resolve_uri
raise ConfigurationError(str(exc))
pymongo.errors.ConfigurationError: query() got an unexpected keyword argument 'lifetime'
pip freeze