-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
36 lines (31 loc) · 973 Bytes
/
app.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
from bs4 import BeautifulSoup
import requests
from flask import Flask, render_template, request
import os
import boto3
app = Flask(__name__)
#from models import Result
@app.route('/', methods=['GET', 'POST'])
def index():
#VARIAVEIS
errors = []
results = {}
sqs = boto3.client('sqs', region_name='us-east-2')
queue_url = 'SQS_QUEUE_URL'
if request.method == "POST":
string = request.form['string']
#r = requests.post('http://',string)
#soup = BeautifulSoup(r.content, 'lxml')
try:
response = sqs.send_message(
QueueUrl=queue_url,
DelaySeconds=10,
MessageAttributes={''},
MessageBody=(string))
except:
errors.append(
"Erro."
)
return render_template('index.html', errors=errors, results=results)
if __name__ == "__main__":
app.run(debug='false',host='0.0.0.0')