def get(self, **kwargs): articles = Article.get({ "user.username": session["user"]["username"], "user.password": session["user"]["password"] }) user = User.get({ "username": session["user"]["username"], "password": session["user"]["password"] })[0] kwargs.__setitem__("articles", articles) kwargs.__setitem__("user", user) return super().get(**kwargs)
def download_history(): try: session_user = session["user"] articles = Article.get({ "user.username": session_user["username"], "user.password": session_user["password"] }) print(articles) make_pdf = MakePDF(json.dumps(articles)) return send_from_directory("./files/pdf", make_pdf.generate_from_string()) except KeyError: return json.dumps([{"result": False}])