As an element in mongodb to put a previously created object of a class?

You 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()
June 3rd 19 at 19:13
1 answer
June 3rd 19 at 19:15
Or functions run bot every time to create the bot object and then initialize it with data from a database?

Find more questions by tags PythonMongoDB