Pymongo doesnt work with multiple url

MongoClient(“mongodb://x:y@x.114.37.y:27017/?replicaSet=rs0,mongodb://x:y@x.253.247.y:27017/?replicaSet=rs0,mongodb://x:y@x.119.129.y:27017/?replicaSet=rs0”)
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.11/dist-packages/pymongo/mongo_client.py”, line 771, in init
res = uri_parser.parse_uri(
^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/pymongo/uri_parser.py”, line 529, in parse_uri
options.update(split_options(opts, validate, warn, normalize))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/pymongo/uri_parser.py”, line 353, in split_options
raise InvalidURI(“MongoDB URI options are key=value pairs.”) from None
pymongo.errors.InvalidURI: MongoDB URI options are key=value pairs.

How do I make pymongo accept multiple url so that even if one url stopps working (i kill mongod for one vps), it should still be able to read and write.

Put the all the hosts in one URI:

MongoClient("mongodb://x:y@x.114.37.y:27017,x.253.247.y:27017,x.119.129.y:27017/?replicaSet=rs0")

See https://www.mongodb.com/docs/manual/reference/connection-string/#std-label-connections-standard-connection-string-format