forked from varia/multifeeder
adding markdown support
This commit is contained in:
parent
3f236e77ff
commit
f6922739b9
54
start.py
54
start.py
@ -32,33 +32,49 @@ def index():
|
|||||||
|
|
||||||
@APP.route("/API/latest/<num>")
|
@APP.route("/API/latest/<num>")
|
||||||
def latest(num):
|
def latest(num):
|
||||||
request = feedtools.latest(num)
|
feed = feedtools.latest(num)
|
||||||
response = APP.response_class(
|
if flask.request.values.get("format") == 'md':
|
||||||
response=json.dumps(request),
|
response_data = feedtools.md(feed)
|
||||||
status=200,
|
mimetype_data = 'text/plain'
|
||||||
mimetype='application/json'
|
else:
|
||||||
)
|
response_data = json.dumps(feed)
|
||||||
return response
|
mimetype_data = 'application/json'
|
||||||
|
|
||||||
@APP.route("/API/today/")
|
return APP.response_class(
|
||||||
def today():
|
response=response_data,
|
||||||
request = feedtools.today()
|
|
||||||
response = APP.response_class(
|
|
||||||
response=json.dumps(request),
|
|
||||||
status=200,
|
status=200,
|
||||||
mimetype='application/json'
|
mimetype=mimetype_data
|
||||||
|
)
|
||||||
|
|
||||||
|
@APP.route("/API/today")
|
||||||
|
def today():
|
||||||
|
feed = feedtools.today()
|
||||||
|
if flask.request.values.get("format") == 'md':
|
||||||
|
response_data = feedtools.md(feed)
|
||||||
|
mimetype_data = 'text/plain'
|
||||||
|
else:
|
||||||
|
response_data = json.dumps(feed)
|
||||||
|
mimetype_data = 'application/json'
|
||||||
|
return APP.response_class(
|
||||||
|
response=response_data,
|
||||||
|
status=200,
|
||||||
|
mimetype=mimetype_data
|
||||||
)
|
)
|
||||||
return response
|
|
||||||
|
|
||||||
@APP.route("/API/past/<days>")
|
@APP.route("/API/past/<days>")
|
||||||
def past(days):
|
def past(days):
|
||||||
request = feedtools.past(days)
|
feed = feedtools.past(days)
|
||||||
response = APP.response_class(
|
if flask.request.values.get("format") == 'md':
|
||||||
response=json.dumps(request),
|
response_data = feedtools.md(feed)
|
||||||
|
mimetype_data = 'text/plain'
|
||||||
|
else:
|
||||||
|
response_data = json.dumps(feed)
|
||||||
|
mimetype_data = 'application/json'
|
||||||
|
return APP.response_class(
|
||||||
|
response=response_data,
|
||||||
status=200,
|
status=200,
|
||||||
mimetype='application/json'
|
mimetype=mimetype_data
|
||||||
)
|
)
|
||||||
return response
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
feedtools.update()
|
feedtools.update()
|
||||||
|
Loading…
Reference in New Issue
Block a user