Search code examples
pythongmail

Python error report sender script that sends reports to my gmail or website via api


Lately I have been trying to script a error report sender that would send error reports to my gmail when a error or bug is detected. I was planning on making it either send the report to my gmail or website via a api. How do I do this?


Solution

  • i personally prefer telegram so i made this functions to report

    def report(bot_message):
        
        bot_token = "your bot token"
        bot_chatID = "your chat id "
        send_text = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?chat_id=' + bot_chatID + '&parse_mode=Markdown&text=' + str(bot_message)
        response = requests.get(send_text)
        return response.json()