[Python] ServerSelectionTimeoutError errno 11001 getaddrinfo failed python

Discussão em 'Python' iniciado por Stack, Maio 2, 2025.

  1. Stack

    Stack Membro Participativo

    mongodb_uri = "mongodb://[username:password@]XX.XX.XX.XX"

    client = MongoClient(mongodb_uri)
    db = client['database']
    print(db)

    collection_taxonomy = db['collection']

    doc = collection_taxonomy.find()
    pprint.pprint(doc)
    for each_doc in doc:
    pprint.pprint(each_doc)


    I am getting time out error as I try to print each document of the collection. However, I do not get time out error when I try to connect to localhost.

    Tried connecting with connect=False client = MongoClient(mongodb_uri,connect=False)

    Still I get time out error while i print each document. What could be wrong? Appreciate if someone can help me . I am using Python 3.5 and Pymongo 3.5.1 Thanks, -Roopa

    Continue reading...

Compartilhe esta Página