From 2d8b314e3252ef3c8f2aac218e45790ab1f4b41f Mon Sep 17 00:00:00 2001 From: mxr612 Date: Fri, 23 Aug 2024 13:21:49 +0800 Subject: [PATCH] added two output --- main.py | 31 +++++++++++++++++-------------- rss.py | 1 + 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index f67316f..3c57d17 100644 --- a/main.py +++ b/main.py @@ -11,19 +11,22 @@ app = FastAPI() def query(query:str): res = [] - list = search_paper(query) - for i in list: - if mysql_connector.is_loaded(i['paperId']): - print(i['paperId']) - else: - print(i['citationStyles']['bibtex']) - res.append({ - 'id':i['paperId'], - 'q':str(i['citationStyles']['bibtex']), - 'a':str(i['abstract']), - 'score':[] - }) - print('New load: '+str(len(res))+'/'+str(len(list))) + try: + list = search_paper(query) + for i in list: + if mysql_connector.is_loaded(i['paperId']): + print(i['paperId']) + else: + print(i['citationStyles']['bibtex']) + res.append({ + 'id':i['paperId'], + 'q':str(i['citationStyles']['bibtex']), + 'a':str(i['abstract']), + 'score':[] + }) + print('New load: '+str(len(res))+'/'+str(len(list))) + except Exception as e: + print(str(e)) return res @app.get("/fastdoi") @@ -37,7 +40,7 @@ async def get_reference(questions): @app.get("/rss") async def miniflux_rss(): - load_rss() + return load_rss() if __name__ == '__main__': import uvicorn diff --git a/rss.py b/rss.py index 6d87fe3..fef228a 100644 --- a/rss.py +++ b/rss.py @@ -48,3 +48,4 @@ def load_rss(): if len(loaded) > 0: update(loaded) print(f"Total entries loaded: {count}") + return f"Total entries loaded: {count}"