Reputation: 662
I have been working on implementing PyTeaser as an API so can send requests using my program to get a summary of an article. I have been trying to figure out how to send url requests to the API using flask. I was having trouble routing my url request because I didn't really understand what goes in the ???? under app route section below so that I can route my requests.
from flask import Flask, jsonify
from PyTeaser import SummarizeUrl
from PyTeaser import Summarize
app = Flask(__name__)
@app.route('????', methods=['GET'])
def summary_url(url):
summary = SummarizeUrl(url)
return jsonify({'title': title, 'url': url, 'summaries': summary})
@app.route('????', methods=['GET'])
def summary(title, text):
summary = Summarize(title, text)
return jsonify({'title': title, 'summaries': summary})
if __name__ == '__main__':
app.run(debug=True,app.run(host='0.0.0.0'))
Upvotes: 1
Views: 110
Reputation: 154
Something like
@app.route('/<url>')
I'm not sure second route as it looks like you want to take in two variables. But possibly:
@app.route('/<title>/<text>')
Upvotes: 1