whendone

Submodules

Package Contents

Classes

WhenDone

Attributes

__version__

class whendone.WhenDone(telegram_token: str = '', slack_token: str = '')[source]
format_time(seconds: float) str[source]

Format the time to display Seconds will be converted to the right time.

Parameters:

seconds (float) – Amount of seconds the code did run.

Returns:

formatted_time – Seconds formated to the right amount of time.

Return type:

str

Examples

format_time(61)

addSlackChatID(id: str) None[source]

Add Slack Chat ID, to send the message(s) to.

Parameters:

id (str) – Slack chat ID obtained from Slack

Examples

notifier = WhenDone(telegram_token=’xxx’,slack_token=’xxx’) notifier.addSlackChatID(id=’X1234’)

__seturl__(telegram_token) None[source]
__dump_to_txt__(chat_ids)[source]
Dump telegram chat ID’s to a .txt file, because Telegram Bot

will restart and forget the current ID’s. This will retrieve them and still succesfully send the message.

Parameters:

chat_ids (json) – Telegram chat ID’s obtained from Telegram

__getchatid__() List[str][source]

Will retrieve the chat ID’s retrieved from the chat-bot.

Returns:

lst – Telegram chat ID’s obtained from Telegram

Return type:

List[str]

__send_message__(message) None[source]

Will send the message through Telegram and/or Slack

Parameters:

message (str) – The message to send

whendone(func)[source]

Wrapper for timing and sending the message through Slack/Telegram

whendone.__version__