Exemple #1
0
 def make_tans(self, logged_user):
     tans = GenerateTans.generate_tans(Controller.TANS_COUNT)
     email_text = ''
     for tan in tans:
         self.manager.add_tan(logged_user.get_username(), tan)
         email_text += str(tan) + '\n'
     if logged_user.get_email() is None:
         return 'Invalid email!'
     Email_Sender.send_email(logged_user.get_email(), email_text)
     return 'TANs sent to email'
Exemple #2
0
 def send_email(self, username, user_email):
     hashed = self.manager.get_hashed_psd(username)
     Email_Sender.send_email(user_email, hashed)
Exemple #3
0
from flask import Flask, request, jsonify
from flask_pymongo import pymongo, ObjectId
from flask_cors import CORS
from web_scraper import Web_Scraper
from email_sender import Email_Sender
from apscheduler.schedulers.background import BackgroundScheduler
import atexit
import os

app = Flask(__name__)
CONNECTION_STRING = os.getenv('mongodb_connection_string')
client = pymongo.MongoClient(CONNECTION_STRING)
db = client.get_database('price_tracker_db').items
scraper = Web_Scraper()
sender = Email_Sender()

cors = CORS(app)


def check_item_prices():
    items = []
    for item in db.find():
        items.append({
            '_id': str(ObjectId(item['_id'])),
            'name': item['name'],
            'image': item['image'],
            'original_price': float(item['original_price']),
            'current_price': float(item['current_price']),
            'url': item['url']
        })
    for item in items: