forked from tsileo/microblog.pub
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfeeds.py
34 lines (25 loc) · 739 Bytes
/
feeds.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
import json
from flask import Response
import flask
import activitypub
blueprint = flask.Blueprint('feeds', __name__, template_folder='templates')
@blueprint.route("/feed.json")
def json_feed():
return Response(
response=json.dumps(
activitypub.json_feed("/feed.json")
),
headers={"Content-Type": "application/json"},
)
@blueprint.route("/feed.atom")
def atom_feed():
return Response(
response=activitypub.gen_feed().atom_str(),
headers={"Content-Type": "application/atom+xml"},
)
@blueprint.route("/feed.rss")
def rss_feed():
return Response(
response=activitypub.gen_feed().rss_str(),
headers={"Content-Type": "application/rss+xml"},
)