Get tweets from local host, python, pymongo
Question: I am trying this code:

    
    
    import pymongo
    import json
    import numpy as np
    
    client = pymongo.MongoClient('localhost', 27017)
    db = client.test
    collection = db['tweets']
    
    print ("Tweets Capturados: ", collection.count())
    

But, I get this error:

    
    
    ServerSelectionTimeoutError: localhost:27017: [WinError 10061] No connection could be made because the target machine actively refused it.
    

Is there a generic localhost from Twitter API that I could use?


Answer: Are you sure MongoDB is running on your local machine? Please check whether it
is up and running. There is nothing wrong with your code. Also that'd be
useful to know which version of pymongo you're using.

> Is there a generic localhost from Twitter API that I could use?

Can you please elaborate this more?

