py_everything.automation

Source code: py_everything/automation.py

This module contains methods that automate certain things or tasks such as sending a mail.

py_everything.automation.sendEmail(sendAddr, password, recvAddr, body, server, port, sub='No Subject')

Sends email to recvAddr from sendAddr. With body as mail body and sub as mail subject. Uses server and port to send the mail.

Parameters
  • sendAddr (str) – The address you want the mail to be sent from.

  • password (str) – To login to the email account.

  • recvAddr (str) – The address to which the mail is to be sent.

  • body (str) – The main body of the email.

  • server (str) – The server through which the mail should be sent.

  • port (str) – The port at which the server is listening.

  • sub (str) – The optional subject of the mail. Defaults to ‘No Subject’ if not specified.

Returns bool

True if mail gets sent successfully.

Note

Less secure app access should be turned on for Gmail. IMAP/POP Forwarding should be enabled in mail settings for this to work. Alos, the server and port should be correct.

py_everything.automation.emailAddressSlicer(fullAddr)

Slices an email address and returns username and domain separately.

Parameters

fullAddr (str) – The full address you want to slice.

Returns tuple

Contaning username and domain..;

py_everything.automation.rollDice(dice1=True)

Rolls dice and returns value between 1 and 6 if dice1=True else returns value between 1 and 12.

Parameters

dice1 (str) – Boolean to understand if 1 dice to roll or 2 dice.

Returns int

Value between 1 and 6 or 1 and 12.

py_everything.automation.timer(seconds, audioFile)

Starts a timer for seconds and plays audioFile when finished.

Parameters

seconds (int) – How many seconds should the timer be for.

py_everything.automation.startApp(exePath)

Starts exePath.

Parameters

exePath (str) – Full path to the exe to be launched.

Returns bool

True if exe starts successfully.

Raises

error.startAppFailedError – This exception is raised if exe was not started successfully. Maybe due to an incorrect path.