skip to Main Content

Why I can't connect my telegram bot to Mongodb Atlas using Python? – Telegram API

This is my code from telegram.ext import Updater, CommandHandler import os from pymongo import MongoClient TOKEN = 'TOKEN' def get_db(update, context): cluster = MongoClient("mongodb+srv://testing:[email protected]/test?retryWrites=true&w=majority") result = list(cluster.get_database('DBNAME')['COLLECTIONNAME'].find({})) update.message.reply_text(str(result)) def main(): updater = Updater(TOKEN, use_context=True) dp = updater.dispatcher dp.add_handler(CommandHandler("getdb", get_db)) updater.start_webhook(listen="#.#.#.#",…

VIEW QUESTION
Back To Top
Search