def run_notify(item_name, exterior, stattrak, max_price, max_float): notify = Notify() print(notify.info()) listings = get_listings(item_name, exterior, stattrak) while True: findings = [] for ind, item in enumerate(listings): a_id, d_id, l_id = get_inspect_id(item) float_val = get_float(a_id, d_id, l_id) price = get_price(item) if float_val <= max_float and price <= max_price: findings.append((price, float_val)) page_count, item_count = index_to_page_count(ind) if findings: for price, float_val in findings: print(f"Found item, float: {float_val}, price: {price}€") notify.send("Found new items!") print( "----------------------------------------------------------------------" ) sleep(30)
class notificator(): def __init__(self): self.notify = Notify() print(self.notify.info()) self.project_name = os.getcwd().split('\\')[ -1] # Using the name of the parent folder self.computer_name = os.environ['COMPUTERNAME'] # This function takes the CSP, classifier, number of channels, and folder with the file to run's #location, as well as the degrees of freedom required for the classifier def send_msg(self, msg): msg_to_send = '[{} - {}]\n' + msg msg_to_send = msg_to_send.format(self.computer_name, self.project_name) self.notify.send(msg_to_send)
def setup_notify_run(): """ Function to create a new notify-run channel. Returns the endpoint URL. """ # Setup notify run channel and print info notify = Notify() notify.register() print(notify.info()) # Save channel endpoint to file save_notify_run_settings(notify) return notify.endpoint
if len(found) > 0: msg = "Elon Tweeted about the following topics: '" + ", ".join( found) + "'" notify = Notify() if notify.config_file_exists: notify.read_config() else: print(notify.register()) notify.write_config() print("[" + str(datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + "] Sending notification: " + msg) notify.send( msg, "https://www.twitter.com/" + PROJECT_SETTINGS['elonHandle']) if __name__ == '__main__': if len(sys.argv) == 2 and sys.argv[1] == "info": notify = Notify() notify.read_config() print(notify.info()) else: with open(os.path.join(BASE_DIR, CONFIG_FILE), 'r') as f: data = f.read() PROJECT_SETTINGS = json.loads(data) check_for_tweets()
import platform import time from selenium import webdriver import smtplib import ssl import os from notify_run import Notify from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart notify = Notify() try: data_user = open("data.txt", "r") except: notify.register() url_notify = str(notify.info()) print("Veuillez vous abonner a cette page pour recevoir les notifications sur votre téléphone :" + url_notify[45:103]) identifiant = str(input("Entrez votre identifiant :")) mdp = str(input("Entrez votre mot de passe :")) email_receiver = str(input("Entrez votre adresse mail :")) choix_save = str(input("Etes vous sur(sauvegarde)? :")) if "yes" in choix_save: data_user = open("data.txt", "x") data_user.writelines([identifiant,"\n",mdp,"\n",email_receiver]) data_user.close() is_there_data= True if "no" in choix_save: print("ok") is_there_data= False else: changement_compte = str(input("Vous voulez changer de compte ?")) if "yes" in changement_compte: