Apprise – Push Notifications that work with just about every platform!

apprise - techblog.co.il

Apprise מאפשרת לך לשלוח הודעה כמעט לכל שירותי ההודעות הפופולאריים ביותר העומדים לרשותנו כיום כגון: Telegram, Discord, Slack, NS, Gotify וכו '.

בין היתרונות הבולטים של המערכת ניתן למנות:

  • ספריית התראות אחת שתשלוט בכולן.
  • תחביר התראות נפוץ ואינטואיטיבי.
  • תמיכה בתמונות וקבצים מצורפים (לשירותי ההודעות שיקבלו אותם).

בעלי מערכות המעוניינים לספק שירות התראה אינם צריכים עוד לחקור כל אחד חדש כפי שהם מופיעים. הם רק צריכים לכלול את הספרייה הזו ואז הם יכולים לקבל גישה כמעט לכל שירותי ההודעות העומדים לרשותנו כיום.

מנהלי מערכות שמעוניינים לשלוח הודעה ממשימה מתוזמנת או משורת הפקודה, אינם צריכים עוד למצוא את הכלי המתאים למשימה. הכל כבר עטוף ותומך בתוך סקריפט ה- apprise המצורף למוצר זה.

התקנה

על מנת להתקין את הסיפריה והתמיכה בה, יש לכתוב את הפקודה הבאה:

pip install apprise

כלי שורת הפקודה

apprise מגיע ביחד עם command line שמאפש שליחת הודעות בצורה פשוטה וקלה, בקטע הקוד הבא תוכלו לראות מספר דוגמאות לכך:

 

# Send a notification to as many servers as you want
# as you can easily chain one after another:
apprise -t 'my title' -b 'my notification body' \
   'mailto://myemail:[email protected]' \
   'pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b'

# If you don't specify a --body (-b) then stdin is used allowing
# you to use the tool as part of your every day administration:
cat /proc/cpuinfo | apprise -t 'cpu info' \
      'mailto://myemail:[email protected]'

# The title field is totally optional
uptime | apprise \
 'discord:///4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js'

קבצי קונפיגורציה

אני לא מכיר מישהו שמעוניין לחשוף את פרטי ההזדהות שלו והסיסמאות לכל מי שיכול לראות את ה command line. לשם כך apprise מאפשרת לשמור את אותם פרטים בקבצי הגדרות. קבצים אלה יכולים להשמר בקבצי YAML וכן בקבצי TEXT. בקישור הבא, תוכלו לראות כיצד נראה הקובץ.

זה המבנה המצופה למיקום של הקבצים:

# By default if no url or configuration is specified aprise will attempt to load
# configuration files (if present):
#  ~/.apprise
#  ~/.apprise.yml
#  ~/.config/apprise
#  ~/.config/apprise.yml

# Windows users can store their default configuration files here:
#  %APPDATA%/Apprise/apprise
#  %APPDATA%/Apprise/apprise.yml
#  %LOCALAPPDATA%/Apprise/apprise
#  %LOCALAPPDATA%/Apprise/apprise.yml

# If you loaded one of those files, your command line gets really easy:
apprise -t 'my title' -b 'my notification body'

# If you want to deviate from the default paths or specify more than one,
# just specify them using the --config switch:
apprise -t 'my title' -b 'my notification body' \
	--config=/path/to/my/config.yml

# Got lots of configuration locations? No problem, you can specify them all:
# Apprise can even fetch the configuration from over a network!
apprise -t 'my title' -b 'my notification body' \
	--config=/path/to/my/config.yml \
	--config=https://localhost/my/apprise/config

צירוף קבצים

apprise מאפשרת בין היתר לצרף קבצים להודעות (בין עם בודד או מספר קבצים). בקטע הקוד הבא תוכלו לראות דוגמה לצירוף קבצים:

# Send a funny image you found on the internet to a colleague:
apprise --title 'Agile Joke' \
        --body 'Did you see this one yet?' \
        --attach https://i.redd.it/my2t4d2fx0u31.jpg \
      'mailto://myemail:[email protected]'

# Easily send an update from a critical server to your dev team
apprise --title 'system crash' \
        --body 'I do not think Jim fixed the bug; see attached...' \
        --attach /var/log/myprogram.log \
        --attach /var/debug/core.2345 \
        --tag devteam

למידע נוסף אודות המערכת והשימושים בה ניתן להכנס לקישור הבא.

שימוש מועיל!

Be the first to comment

Leave a Reply

כתובת האימייל שלך לא תפורסם


*