def _send_notifications(title, body, settings): if settings.get('notify_discord') is True: import discord_notify notifier = discord_notify.Notifier(settings.get('discord_webhook_url')) notifier.send(body, print_message=False) if settings.get('notify_sound') is True: import playsound playsound.playsound(settings.get('song')) if settings.get('notify_pushover') is True: import pushover client = pushover.Client(settings.get('pushover_user_key'), api_token=settings.get('pushover_api_key')) client.send_message(body, title=title) if settings.get('notify_telegram') is True: import telegram_notifier notifier = telegram_notifier.TelegramNotifier( settings.get('telegram_token'), parse_mode="HTML") notifier.send(body) if settings.get('notify_ifttt') is True: import requests requests.post(settings.get('ifttt_webhook_url'), data={ 'value1': title, 'value2': body })
def _send_notifications(title, body, settings): if settings.get('notify_discord') is True: notifier = discord_notify.Notifier(settings.get('discord_webhook_url')) notifier.send(body, print_message=False) if settings.get('notify_sound') is True: playsound.playsound(settings.get('song')) if settings.get('notify_pushover') is True: client = pushover.Client(settings.get('pushover_user_key'), api_token=settings.get('pushover_api_key')) client.send_message(body, title=title)
if (firstRun == True): shouldPrint = True msgTitle = "Your wallet as of {}".format(datetime.date.today()) msgTxt = "You have a total of {} XCH, Farmer!".format(netBalance) else: if currXCH != netBalance: shouldPrint = True msgTxt = "Your Chia balance has changed, for a total of {netBalance} XCH, Chia Pet!".format( netBalance=data['netBalance'] / 1000000000000) msgTitle = 'Congrats, Chia Farmer!' if sendDiscord == True: import discord_notify as dn discord_info = msgTxt notifier = dn.Notifier(discordWebhook) notifier.send(discord_info, print_message=False) if sendPushover == True: from pushover import init, Client client = Client(pushoverUserKey, api_token=pushoverAPIKey) client.send_message( msgTxt, title=msgTitle) #pip install python-pushover if playSound == True: from playsound import playsound #pip install playsound playsound(song) if sendSlack == True: post_message_to_slack(msgTxt)
import requests from bs4 import BeautifulSoup import discord_notify as dn import os s = requests.Session() API_url = 'https://webjapps.ias.ac.in/fellowship2021/lists/selectedList.jsp' request_headers = { "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36", "Referer": "https://webjapps.ias.ac.in/fellowship2021/lists/result.jsp", "Accept-Language": "en-IN,en-GB;q=0.9,en-US;q=0.8,en;q=0.7", "Cookie": "JSESSIONID=DEEED769CD07BB27DCD68B6EF4459E51" } params = {'subject': 'Lif'} r = s.get(API_url, params=params, headers=request_headers) soup = BeautifulSoup(r.content, 'html5lib') DISCORD_URL = os.environ.get('DISCORD_URL') print(DISCORD_URL) notifier = dn.Notifier(DISCORD_URL) if "Ballaney, Mr Pranav" in str(soup): notifier.send("Yayyyy!", print_message=False) notifier.send("Yayyyy!", print_message=False)