My coupen codes are saved on mongodb and I wanted to read it when the user required it
here is the custom actions code
from typing import Any, Text, Dict, List
from pymongo.database import Database
from pymongo import MongoClient
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
import pymongo
# url="http://localhost:3000/api"
class Coupens(Action):
def name(self):
return "Coupens"
def run(self, dispatcher, tracker, domain):
clientss = pymongo.MongoClient("mongodb+srv://username:pswd@cluster1-hc9jb.azure.mongodb.net/test?retryWrites=true&w=majority")
db=clientss.client
res = db.coupen.find({})
print(type(res))
for i in res:
dispatcher.utter_message(i.items() )
return []
what do I expect
dict_items([('_id', ObjectId('5e2620411c9d44000081b6b1')), ('نون %1', 'YVQA HMAZ EMVY TVKL Hi3 Hi2 Hi1')])
dict_items([('_id', ObjectId('5e2621fc1c9d44000081b6b2')), ('شي إن 15 ', '15AFT')])
but this is the output I got
Please help me Thanks in advance