ExceptNotifier package

Subpackages

Module contents

show-inheritance:

exception ExceptNotifier.ExceptBeep(*args: object)

Override excepthook to send error message to beep.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static beep(sec=1, freq=1000) None

Make beep sound

Parameters:
  • sec (int, optional) – beep duration, defaults to 1

  • freq (int, optional) – beep fequency, defaults to 1000

ExceptNotifier.ExceptBeepIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sounding system beep.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptChime(*args: object)

Override excepthook to send error message to AWS Chime.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_chime_msg(_CHIME_WEBHOOK_URL: str, msg: str) dict

Send message to chat room through chime app’s webhook url.

Parameters:
  • _CHIME_WEBHOOK_URL (str) – Webhook url from chime app

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.ExceptChimeIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending Chime message.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptDesktop(*args: object)

Override excepthook to send error message to Desktop.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_desktop_msg(title_msg: str, body_msg: str, DISP_TIME=5) None

Sending notification to desktop

Parameters:
  • title_msg (str) – Title of message

  • body_msg (str) – Body of message

  • DISP_TIME (int, optional) – Time duration, defaults to 5

ExceptNotifier.ExceptDesktopIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending Desktop notification via plyer.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptDiscord(*args: object)

Override excepthook to send error message to Discord.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_discord_msg(_DISCORD_WEBHOOK_URL: str, msg: str) dict

Send message to chat room through discord app’s webhook url.

Parameters:
  • _DISCORD_WEBHOOK_URL (str) – Webhook url from discord app

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.ExceptDiscordIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending Discord.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptKakao(*args: object)

Override excepthook to send error message to Kakaotalk.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_kakao_msg(_KAKAO_TOKEN_PATH: str, msg: str) dict

Send message to chat room through kakaotalk app’s REST API.

Parameters:
  • _KAKAO_TOKEN_PATH (str) – Kakaotalk token path

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.ExceptKakaoIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending Kakaotalk.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptLine(*args: object)

Override excepthook to send error message to Line.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_line_msg(_LINE_NOTIFY_API_TOKEN: str, msg: str) dict

Send message to chat room through Line app’s REST API.

Parameters:
  • _LINE_NOTIFY_API_TOKEN (str) – Line notify API token

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.ExceptLineIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending Line message.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptMail(*args: object)

Override excepthook to send error message to Gmail.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_gmail_msg(from_email_addr: str, to_email_addr: str, from_email_app_password: str, subject_msg: str, body_msg: str) dict

Send mail through gmail smtp server

Parameters:
  • from_email_addr (str) – Gmail address who send message

  • to_email_addr (str) – Gmail address who receive message

  • from_email_app_password (str) – Google app password

  • subject_msg (str) – Mail title

  • body_msg (str) – Mail body

Returns:

Response according to sending request

Return type:

dict

ExceptNotifier.ExceptMailIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending Gmail.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptSMS(*args: object)

Override excepthook to send error message to SMS.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_sms_msg(_TWILIO_SID: str, _TWILIO_TOKEN: str, _SENDER_PHONE_NUMBER: str, _RECIPIENT_PHONE_NUMBER: str, msg: str) dict

Send SMS through twilio platform. https://www.twilio.com/en-us

Parameters:
  • _TWILIO_SID (str) – Twilio personal _TWILIO_SID

  • _TWILIO_TOKEN (str) – Twilio personal _TWILIO_TOKEN

  • _SENDER_PHONE_NUMBER (str) – Sender phone number

  • _RECIPIENT_PHONE_NUMBER (str) – Recipient phone number

  • msg (str) – SMS content

Returns:

Response dict

Return type:

dict

ExceptNotifier.ExceptSMSIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending SMS.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptSlack(*args: object)

Override excepthook to send error message to Slack.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_slack_msg(_SLACK_WEBHOOK_URL: str, msg: str) dict

Send message to chat room through slack app’s api.

Parameters:
  • _SLACK_WEBHOOK_URL (str) – _SLACK_WEBHOOK_URL from slack app

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.ExceptSlackIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending slack message.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptTeams(*args: object)

Override excepthook to send error message to Microsoft Teams.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_teams_msg(_TEAMS_WEBHOOK_URL, msg)

Send message to chat room through microsoft teams app’s webhook url.

Parameters:
  • _TEAMS_WEBHOOK_URL (str) – _TEAMS_WEBHOOK_URL from teams app

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.ExceptTeamsIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending teams message.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptTelegram(*args: object)

Override excepthook to send error message to Telegram.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_telegram_msg(_TELEGRAM_TOKEN: str, msg: str) dict

Send message via telegram bot.

Parameters:
  • _TELEGRAM_TOKEN (str) – Telegram secure bot Token

  • msg (str) – Message content

Returns:

Response dict

Return type:

dict

ExceptNotifier.ExceptTelegramIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending Telegram.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

exception ExceptNotifier.ExceptWechat(*args: object)

Override excepthook to send error message to Wechat.

Parameters:
  • etype (_type_) – Error Type

  • value (_type_) – Error Value

  • tb (_type_) – Traceback Information

static send_wechat_msg(_WECHAT_WEBHOOK_URL: str, msg: str) None

Send message to wechat.

Parameters:
ExceptNotifier.ExceptWechatIpython(shell: object, etype: object, evalue: object, tb: object, tb_offset=1) None

ExceptNotifier function for overriding custom execute in ipython for sending Wechat message.

Parameters:
  • shell (object) – Excecuted shell, ZMQInteractiveShell object.

  • etype (object) – Error type

  • evalue (object) – Error value

  • tb (object) – TraceBack object of Ipython

  • tb_offset (int, optional) – Offset of traceback, defaults to 1

class ExceptNotifier.SendBeep

Send beep

class ExceptNotifier.SendChime

Sending message to AWS Chime

class ExceptNotifier.SendDesktop

Sending message to Desktop

class ExceptNotifier.SendDiscord

Sending message to Discord

class ExceptNotifier.SendKakao

Sending message to Kakaotalk

class ExceptNotifier.SendLine

Sending success message to Line

class ExceptNotifier.SendMail

Sending message to Gmail

class ExceptNotifier.SendSMS

Sending message to SMS

class ExceptNotifier.SendSlack

Sending message to Slack

class ExceptNotifier.SendTeams

Sending message to microsoft teams

class ExceptNotifier.SendTelegram

Sending message to telegram

class ExceptNotifier.SendWechat

Sending message to wechat

class ExceptNotifier.SuccessBeep

Success beep

class ExceptNotifier.SuccessChime

Sending success message to AWS Chime

class ExceptNotifier.SuccessDesktop

Sending success message to Desktop

class ExceptNotifier.SuccessDiscord

Sending success message to Discord

class ExceptNotifier.SuccessKakao

Sending success message to Kakaotalk

class ExceptNotifier.SuccessLine

Sending success message to Line

class ExceptNotifier.SuccessMail

Sending success message to Gmail

class ExceptNotifier.SuccessSMS

Sending success message to SMS

class ExceptNotifier.SuccessSlack

Sending success message to Slack

class ExceptNotifier.SuccessTeams

Sending success message to microsoft teams

class ExceptNotifier.SuccessTelegram

Sending success message to telegram

class ExceptNotifier.SuccessWechat

Sending success message to wechat

ExceptNotifier.beep(sec=1, freq=1000) None

Make beep sound

Parameters:
  • sec (int, optional) – Beep duration, defaults to 1

  • freq (int, optional) – Beep fequency, defaults to 1000

ExceptNotifier.get_authorize_code(rest_api_key: str) None

Get authorize code link by using KAKAO REST API KEY

Parameters:

rest_api_key (str) – REST API KEY

ExceptNotifier.get_resp_openai_advice(_OPEN_AI_MODEL: str, _OPEN_AI_API: str, error_message: str) dict

Check response of Open AI API status

Parameters:
  • _OPEN_AI_MODEL (str) – model name of open ai

  • _OPEN_AI_API (str) – API KEY value of open ai

  • error_message (str) – Error message

Returns:

Returns response dict to openai

Return type:

dict

ExceptNotifier.receive_bard_advice(_BARD_API_KEY: str, error_message: str) str

Receive debugging information about your code from google bard. :param _OPEN_AI_API:__Secure-1PSID value of google bard :type _OPEN_AI_API: str :param error_message: Error message :type error_message: str :return: Returns a description and example of the code, the location of the error, and a debugging code example. :rtype: str

ExceptNotifier.receive_openai_advice(_OPEN_AI_MODEL: str, _OPEN_AI_API: str, error_message: str) str

Receive debugging information about your code from models in open ai.

Parameters:
  • _OPEN_AI_MODEL (str) – model name of open ai

  • _OPEN_AI_API (str) – API KEY value of open ai

  • error_message (str) – Error message

Returns:

Returns a description and example of the code, the location of the error, and a debugging code example.

Return type:

str

ExceptNotifier.save_token(rest_api_key: str, authorize_code: str, token_path: str) dict

Receive authorized token and save it in json format.

Parameters:
  • rest_api_key (str) – REST API KEY

  • authorize_code (str) – The code that comes out when you click the link that comes as the return value of the get_authorize_code function.

  • token_path (str) – Path to store token

Returns:

Generated tokens

Return type:

dict

ExceptNotifier.send_chime_msg(_CHIME_WEBHOOK_URL: str, msg: str) dict

Send message to chat room through chime app’s webhook url.

Parameters:
  • _CHIME_WEBHOOK_URL (str) – Webhook url from chime app

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.send_desktop_msg(title_msg: str, body_msg: str, DISP_TIME=5) None

Sending notification to desktop

Parameters:
  • title_msg (str) – Title of message

  • body_msg (str) – Body of message

  • DISP_TIME (int, optional) – Time duration, defaults to 5

ExceptNotifier.send_discord_msg(_DISCORD_WEBHOOK_URL: str, msg: str) dict

Send message to chat room through discord app’s webhook url.

Parameters:
  • _DISCORD_WEBHOOK_URL (str) – Webhook url from discord app

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.send_gmail_msg(_GMAIL_SENDER_ADDR: str, _GAMIL_RECIPIENT_ADDR: str, _GMAIL_APP_PASSWORD_OF_SENDER: str, subject_msg: str, body_msg: str) dict

Send mail through gmail smtp server

Parameters:
  • _GMAIL_SENDER_ADDR (str) – Gmail address who send message

  • _GAMIL_RECIPIENT_ADDR (str) – Gmail address who receive message

  • _GMAIL_APP_PASSWORD_OF_SENDER (str) – Google app password

  • subject_msg (str) – Mail title

  • body_msg (str) – Mail body

Returns:

Response according to sending request

Return type:

dict

ExceptNotifier.send_kakao_msg(_KAKAO_TOKEN_PATH: str, msg: str) dict

Send message to chat room through kakaotalk app’s REST API.

Parameters:
  • _KAKAO_TOKEN_PATH (str) – Kakaotalk token path

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.send_line_msg(_LINE_NOTIFY_API_TOKEN: str, msg: str) dict

Send message to chat room through Line app’s REST API.

Parameters:
  • _LINE_NOTIFY_API_TOKEN (str) – Line notify API token

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.send_slack_msg(_SLACK_WEBHOOK_URL: str, msg: str) dict

Send message to chat room through slack app’s api.

Parameters:
  • _SLACK_WEBHOOK_URL (str) – _SLACK_WEBHOOK_URL from slack app

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.send_sms_msg(_TWILIO_SID: str, _TWILIO_TOKEN: str, _SENDER_PHONE_NUMBER: str, _RECIPIENT_PHONE_NUMBER: str, msg: str) dict

Send SMS through twilio platform. https://www.twilio.com/en-us

Parameters:
  • _TWILIO_SID (str) – Twilio personal _TWILIO_SID

  • _TWILIO_TOKEN (str) – Twilio personal _TWILIO_TOKEN

  • _SENDER_PHONE_NUMBER (str) – Sender phone number

  • _RECIPIENT_PHONE_NUMBER (str) – Recipient phone number

  • msg (str) – SMS content

Returns:

Response dict

Return type:

dict

ExceptNotifier.send_teams_msg(_TEAMS_WEBHOOK_URL, msg)

Send message to chat room through microsoft teams app’s webhook url.

Parameters:
  • _TEAMS_WEBHOOK_URL (str) – _TEAMS_WEBHOOK_URL from teams app

  • msg (str) – Message text

Returns:

Response according to REST API request

Return type:

dict

ExceptNotifier.send_telegram_msg(_TELEGRAM_TOKEN: str, msg: str) dict

Send message via telegram bot.

Parameters:
  • _TELEGRAM_TOKEN (str) – Telegram secure bot Token

  • msg (str) – Message content

Returns:

Response dict

Return type:

dict

ExceptNotifier.send_wechat_msg(_WECHAT_WEBHOOK_URL: str, msg: str) None

Send message to wechat.

Parameters:
ExceptNotifier.send_whatsapp_msg(msg: str, sender_phone_number_id: str, TOKEN: str, receiver_number: str, recipient_type: str = 'individual') dict

Send me a message via whatsapp. However, from v16 api, it seems to have been changed so that templates that have passed deliberation can be sent. Therefore, it is NOT used by ExceptNotifier.

Parameters:
  • msg (str) – Message content (Cannot be used as it is not a template)

  • sender_phone_number_id (str) – Sender phone number

  • TOKEN (str) – Whatsapp personal token

  • receiver_number (str) – Recipient phone number

  • recipient_type (str, optional) – Type of recipient, defaults to “individual”

Returns:

_description_

Return type:

dict