Skip to content

Commit

Permalink
feat: added flask-restful
Browse files Browse the repository at this point in the history
  • Loading branch information
l0rtk committed Dec 21, 2021
1 parent be97753 commit be28574
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
from flask import Flask,render_template,url_for,request,redirect
from flask_restful import Resource, Api,reqparse

app = Flask(__name__)
api = Api(app)


parser = reqparse.RequestParser()
parser.add_argument('keywords')
parser.add_argument('websites')





@app.route("/",methods=["GET","POST"])
def index():
Expand All @@ -13,10 +24,31 @@ def index():

@app.route("/loading", methods=["GET","POST"])
def loading():
keywords = request.args["keywords"].split(',')
websites = request.args["websites"].split(',')
keywords = request.args["keywords"]
websites = request.args["websites"]

return render_template("spinner.html",keywords = keywords,websites = websites)


class Sentences(Resource):
def get(self):
return {'hello': 'world'}


def post(self):
args = parser.parse_args()

keywords = args["keywords"].split(',')
websites = args["websites"].split(',')

return {"fuck" : "YOU"}





api.add_resource(Sentences, '/hello_world')

return render_template("spinner.html")

if "__main__" == __name__:
app.run()

0 comments on commit be28574

Please sign in to comment.