Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| development:python [2023/08/03 14:03] – Zyzonix | development:python [2024/02/27 07:32] (current) – Zyzonix | ||
|---|---|---|---|
| Line 52: | Line 52: | ||
| return mailText | return mailText | ||
| - | def sendMail(self, hosts, awakeList, failedList, statusUnknownList): | + | def sendMail(self): |
| if EMAILRECEIVER and EMAILSENDER and MAILSERVER and MAILSERVERPORT: | if EMAILRECEIVER and EMAILSENDER and MAILSERVER and MAILSERVERPORT: | ||
| import smtplib | import smtplib | ||
| Line 65: | Line 65: | ||
| msgRoot = MIMEMultipart(" | msgRoot = MIMEMultipart(" | ||
| msgRoot[' | msgRoot[' | ||
| - | msgRoot[' | + | msgRoot[' |
| msgRoot[' | msgRoot[' | ||
| - | mailContent = MIMEText(wakeup.buildMail(self)) | + | mailContent = MIMEText(buildMail(self)) |
| mailText = MIMEText(mailContent, | mailText = MIMEText(mailContent, | ||
| msgRoot.attach(mailText) | msgRoot.attach(mailText) | ||
| Line 119: | Line 119: | ||
| | | ||
| | | ||
| - | mailContent = wakeup.buildMail(self) | + | mailContent = buildMail(self) |
| mailText = MIMEText(mailContent, | mailText = MIMEText(mailContent, | ||
| | | ||
| Line 127: | Line 127: | ||
| | | ||
| except: | except: | ||
| - | | + | |
| - | | + | |
| | | ||
| else: | else: | ||
| - | | + | |
| </ | </ | ||
| ++++ | ++++ | ||
| Line 137: | Line 137: | ||
| ==== Execute Bash command and capture output ==== | ==== Execute Bash command and capture output ==== | ||
| - | <panel type=" | + | //The output will be captured when the command exited.// |
| + | <panel type=" | ||
| ++++ Show/Hide | | ++++ Show/Hide | | ||
| <code bash> | <code bash> | ||
| - | + | resultEncoded = subprocess.run("/ | |
| + | result = resultEncoded.stdout.decode()[: | ||
| + | resultErr = resultEncoded.stderr.decode()[: | ||
| </ | </ | ||
| ++++ | ++++ | ||
| Line 146: | Line 149: | ||
| //Sourced from [[https:// | //Sourced from [[https:// | ||
| + | |||
| + | ==== Get current Memory (RAM) information/ | ||
| + | //Using '' | ||
| + | <panel type=" | ||
| + | ++++ Show/Hide | | ||
| + | <code bash> | ||
| + | ++++ | ||
| + | </ | ||
| + | |||
| + | ==== FastAPI/ | ||
| + | === Change Log Format === | ||
| + | Adding the following lines to your '' | ||
| + | <code bash> | ||
| + | log_config = uvicorn.config.LOGGING_CONFIG | ||
| + | log_config[" | ||
| + | uvicorn.run(app, | ||
| + | </ | ||
| + | |||
| + | //Sourced from [[https:// | ||