Y
Y
Yevgeni2018-07-22 01:34:34
Python
Yevgeni, 2018-07-22 01:34:34

How to shove a previously created class object into a mongodb element?

Need something like this:

from tweepy_bot import TwitterBot
def create_bot():
    bot_obj = Twitter()
    bots_collection = mongo.db.bots 
    new_bot = {
   'bot_name': 'bot1bot1',
   'link': bot_obj
}
bots_collection.insert(new_bot)

def run_bot(bot_name):
 bots_collection = mongo.db.bots 
 founded_bot  = bot_collection.found_one({'bot_name'}:bot_name):
 founded_bot['link'].run()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yevgeni, 2018-07-22
@Yevgeni

Or in the run bot function, create a bot object each time and then initialize it using data from the database?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question