-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
40 lines (31 loc) · 1.11 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from flask import Flask, request, render_template
from flask import Flask
from t_models import bot
from database import Base, session, engine
app = Flask(__name__)
# app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
#create new tables
Base.metadata.create_all(bind=engine)
@app.route('/', methods=['GET', 'POST'])
def bot():
if request.method == 'GET':
print('doing manual check')
print({'status': 'checking walmart'})
time.sleep(3)
print({'status': 'checking best buy'})
time.sleep(3)
print({'status': 'checking target'})
time.sleep(3)
print({'inventory status': 'sold out'})
time.sleep(1)
print({'message type': 'text'})
time.sleep(1)
print({'text mae': false})
else:
title = request.form['title']
poster_url = m.build_imgurl(title)
r = requests.get(poster_url)
if r.status_code != 200:
message = "No match"
return {"status": "no retweets"}
# return render_template("photo.html", image=poster_url)