-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathflask_start.py
36 lines (29 loc) · 1.23 KB
/
flask_start.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
#!/usr/bin/env python3
from flask import Flask, request, render_template
from flask_bootstrap import Bootstrap
from flask_wtf import FlaskForm
from wtforms import fields, StringField, TextAreaField, SubmitField, SelectField, validators
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo, Length
import get_phones_sn
app = Flask(__name__)
bootstrap = Bootstrap(app)
app.config.update(dict(SECRET_KEY="powerful secretkey",
WTF_CSRF_SECRET_KEY="a csrf secret key"))
class MainForm(FlaskForm):
num = StringField("Number mask", [validators.DataRequired("Please enter mask")], default="*",
render_kw={'maxlength': 5})
model = SelectField('Model',
choices=[('255', 'Any'), ('592', 'Cisco 3905'), ('36213', 'Cisco 7811'), ('621', 'Cisco 7821')], default="255")
message = TextAreaField("Message")
submit = SubmitField("Send")
@app.route("/", methods=['GET', 'POST'])
def a():
form = MainForm()
out = ''
num = form.num.data
model = form.model.data
if form.validate_on_submit():
out = get_phones_sn.getphonessn(model = model, num = num, ip = '', name = '', max = 1500)
return render_template('index.html', maintext=str(out), form = form)
if __name__ == '__main__':
app.run()