mirror of
https://codeberg.org/privacy1st/exec-notify
synced 2024-12-22 23:16:04 +01:00
v0.1.7
This commit is contained in:
parent
35c41c3ff2
commit
80323e25c7
@ -59,9 +59,9 @@ python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps --upg
|
||||
|
||||
Note about usage of TestPyPI and `--no-deps`:
|
||||
|
||||
> Since TestPyPI doesn’t have the same packages as the live PyPI, it’s possible that attempting
|
||||
> Since TestPyPI doesn't have the same packages as the live PyPI, it's possible that attempting
|
||||
> to install dependencies may fail or install something unexpected. While this package
|
||||
> doesn’t have any dependencies, it’s a good practice to avoid installing dependencies when
|
||||
> doesn't have any dependencies, it's a good practice to avoid installing dependencies when
|
||||
> using TestPyPI.
|
||||
|
||||
(Optionally) list installed modules:
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
[metadata]
|
||||
name = de.p1st.exec_notify
|
||||
version = 0.1.6
|
||||
version = 0.1.7
|
||||
author = Daniel Langbein
|
||||
author_email = daniel@systemli.org
|
||||
description = mail notification if command fails
|
||||
|
@ -4,7 +4,7 @@ from sys import argv
|
||||
import socket
|
||||
from typing import List
|
||||
|
||||
from de.p1st.exec_notify.lib import exec, config, mail, util
|
||||
from de.p1st.exec_notify.lib import exec, mail, util
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -19,10 +19,10 @@ class LazyConfig:
|
||||
return LazyConfig._config[section][key]
|
||||
|
||||
|
||||
def getHostAndPort() -> Tuple[str, str]:
|
||||
def getHostAndPort() -> Tuple[str, int]:
|
||||
try:
|
||||
return LazyConfig.get('mail', 'host'), LazyConfig.get('mail', 'port')
|
||||
except Exception as e:
|
||||
return LazyConfig.get('mail', 'host'), int(LazyConfig.get('mail', 'port'))
|
||||
except Exception:
|
||||
print(f'execNotify>> Could not read value [mail][host] from {_getCfgFile()}', file=stderr)
|
||||
traceback.print_exc()
|
||||
exit(1)
|
||||
@ -31,7 +31,7 @@ def getHostAndPort() -> Tuple[str, str]:
|
||||
def getPassword() -> str:
|
||||
try:
|
||||
return LazyConfig.get('mail', 'password')
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print(f'execNotify>> Could not read value [mail][password] from {_getCfgFile()}', file=stderr)
|
||||
traceback.print_exc()
|
||||
exit(1)
|
||||
@ -40,7 +40,7 @@ def getPassword() -> str:
|
||||
def getFrom() -> str:
|
||||
try:
|
||||
return LazyConfig.get('mail', 'from') # used for mail login as well
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print(f'execNotify>> Could not read value [mail][from] from {_getCfgFile()}', file=stderr)
|
||||
traceback.print_exc()
|
||||
exit(1)
|
||||
@ -49,7 +49,7 @@ def getFrom() -> str:
|
||||
def getTo() -> str:
|
||||
try:
|
||||
return LazyConfig.get('mail', 'to')
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print(f'execNotify>> Could not read value [mail][to] from {_getCfgFile()}', file=stderr)
|
||||
traceback.print_exc()
|
||||
exit(1)
|
||||
@ -58,7 +58,7 @@ def getTo() -> str:
|
||||
def getMailDir() -> Path:
|
||||
try:
|
||||
return Path(LazyConfig.get('file', 'maildir'))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print(f'execNotify>> Could not read value [file][maildir] from {_getCfgFile()}', file=stderr)
|
||||
traceback.print_exc()
|
||||
exit(1)
|
||||
|
@ -1,7 +1,7 @@
|
||||
from sys import stderr
|
||||
import sys
|
||||
import datetime
|
||||
import smtplib, ssl
|
||||
import socket
|
||||
import smtplib
|
||||
import ssl
|
||||
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
@ -22,8 +22,8 @@ def sendMailOrWriteToFile(SUBJECT: str, BODY: str, informAboutLocalMail: bool =
|
||||
try:
|
||||
sendMail(SUBJECT=SUBJECT, BODY=BODY)
|
||||
except Exception as e:
|
||||
print(f'execNotify>> Could not send mail: {e}', file=stderr)
|
||||
print(f'execNotify>> Writing to file instead ...', file=stderr)
|
||||
print(f'execNotify>> Could not send mail: {e}', file=sys.stderr)
|
||||
print(f'execNotify>> Writing to file instead ...', file=sys.stderr)
|
||||
|
||||
# Instead, try to save the mail so that the user can read
|
||||
# it later when connected to this computer
|
||||
|
@ -2,7 +2,7 @@
|
||||
from sys import argv, stderr, stdin
|
||||
import socket
|
||||
|
||||
from de.p1st.exec_notify.lib import exec, config, mail
|
||||
from de.p1st.exec_notify.lib import mail
|
||||
|
||||
|
||||
def main():
|
||||
|
Loading…
Reference in New Issue
Block a user