aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/export.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r/export.py')
-rw-r--r--pyaggr3g470r/export.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/pyaggr3g470r/export.py b/pyaggr3g470r/export.py
index 243b6843..502c82db 100644
--- a/pyaggr3g470r/export.py
+++ b/pyaggr3g470r/export.py
@@ -39,6 +39,8 @@ import time
import tarfile
from datetime import datetime
+from flask import jsonify
+
import conf
import models
@@ -197,4 +199,25 @@ def export_html(user):
shutil.rmtree(webzine_root)
with open(conf.WEBZINE_ROOT + archive_file_name, 'r') as export_file:
- return export_file.read(), archive_file_name \ No newline at end of file
+ return export_file.read(), archive_file_name
+
+def export_json(user):
+ """
+ """
+ result = []
+ for feed in user.feeds:
+ result.append({
+ "title": feed.title,
+ "description": feed.description,
+ "link": feed.link,
+ "site_link": feed.site_link,
+ "articles": [ {
+ "title": article.title,
+ "link": article.link,
+ "content": article.content
+ }
+ for article in feed.articles
+ ]
+ })
+
+ return jsonify(result=result)
bgstack15