Loading endpoints/rand_msg.py +12 −12 Changes for endpoints/rand_msg.py: 12 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -33,8 +33,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "qajoke.db") # For qajoke db db_query = "SELECT id, ('<b>Q:</b> ' || question || '<br/><b>A:</b> '" \ "|| answer) FROM jokes ORDER BY RANDOM() LIMIT 1" # For qajoke db db_query = "SELECT id, ('<b>Q:</b> ' || question || '<br/><b>A:</b> ' \ || answer) FROM jokes ORDER BY RANDOM() LIMIT 1" # For qajoke db title_attr = "QA Joke DB" case 1: randmsg_db_path = os.path.join("/", Loading @@ -42,8 +42,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "randmsg.db") # For randmsg db db_query = "SELECT id, msg FROM msgs WHERE" \ "LENGTH(msg) <= 180 ORDER BY RANDOM() LIMIT 1" # For randmsg db db_query = "SELECT id, msg FROM msgs WHERE \ LENGTH(msg) <= 180 ORDER BY RANDOM() LIMIT 1" # For randmsg db title_attr = "Random Msg DB" case 2: randmsg_db_path = os.path.join("/", Loading @@ -51,8 +51,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "trump.db") # For Trump Tweet DB db_query = "SELECT id, content FROM tweets" \ "ORDER BY RANDOM() LIMIT 1" # For Trump Tweet DB db_query = "SELECT id, content FROM tweets \ ORDER BY RANDOM() LIMIT 1" # For Trump Tweet DB title_attr = "Trump Tweet DB" case 3: randmsg_db_path = os.path.join("/", Loading @@ -60,8 +60,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "philo.db") # For Philo DB db_query = "SELECT id, (content || '<br> - ' || speaker) FROM quotes" \ "ORDER BY RANDOM() LIMIT 1" # For Philo DB db_query = "SELECT id, (content || '<br> - ' || speaker) FROM quotes \ ORDER BY RANDOM() LIMIT 1" # For Philo DB title_attr = "Philosophical Quotes DB" case 4: randmsg_db_path = os.path.join("/", Loading @@ -69,8 +69,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "hate.db") # For Hate DB db_query = """SELECT id, ("<font color='#FF0000'>" || comment) FROM hate_speech" \ "WHERE length(comment) <= 180 ORDER BY RANDOM() LIMIT 1""" db_query = """SELECT id, ("<font color='#FF0000'>" || comment) FROM hate_speech \ WHERE length(comment) <= 180 ORDER BY RANDOM() LIMIT 1""" title_attr = "Hate Speech DB" case 5: randmsg_db_path = os.path.join("/", Loading @@ -78,8 +78,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "rjokes.db") # r/jokes DB db_query = """SELECT id, (title || "<br>" || body) FROM jokes""" \ """WHERE score >= 10000 ORDER BY RANDOM() LIMIT 1""" db_query = """SELECT id, (title || "<br>" || body) FROM jokes \ WHERE score >= 10000 ORDER BY RANDOM() LIMIT 1""" title_attr = "r/jokes DB" case 6: randmsg_db_path = os.path.join("/", Loading main.py +3 −7 Changes for main.py: 3 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ import importlib import logging from typing import Union, Any from fastapi import FastAPI, HTTPException, Response, Form from typing import Any from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware logger = logging.getLogger() Loading Loading @@ -33,12 +33,8 @@ Blacklisted routes def disallow_get(): return util.get_blocked_response() @app.get("/favicon.ico") def disallow_get(): return util.get_blocked_response() @app.get("/{any}") def disallow_get(any: Any): def disallow_get_any(var: Any): return util.get_blocked_response() @app.post("/") Loading Loading
endpoints/rand_msg.py +12 −12 Changes for endpoints/rand_msg.py: 12 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -33,8 +33,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "qajoke.db") # For qajoke db db_query = "SELECT id, ('<b>Q:</b> ' || question || '<br/><b>A:</b> '" \ "|| answer) FROM jokes ORDER BY RANDOM() LIMIT 1" # For qajoke db db_query = "SELECT id, ('<b>Q:</b> ' || question || '<br/><b>A:</b> ' \ || answer) FROM jokes ORDER BY RANDOM() LIMIT 1" # For qajoke db title_attr = "QA Joke DB" case 1: randmsg_db_path = os.path.join("/", Loading @@ -42,8 +42,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "randmsg.db") # For randmsg db db_query = "SELECT id, msg FROM msgs WHERE" \ "LENGTH(msg) <= 180 ORDER BY RANDOM() LIMIT 1" # For randmsg db db_query = "SELECT id, msg FROM msgs WHERE \ LENGTH(msg) <= 180 ORDER BY RANDOM() LIMIT 1" # For randmsg db title_attr = "Random Msg DB" case 2: randmsg_db_path = os.path.join("/", Loading @@ -51,8 +51,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "trump.db") # For Trump Tweet DB db_query = "SELECT id, content FROM tweets" \ "ORDER BY RANDOM() LIMIT 1" # For Trump Tweet DB db_query = "SELECT id, content FROM tweets \ ORDER BY RANDOM() LIMIT 1" # For Trump Tweet DB title_attr = "Trump Tweet DB" case 3: randmsg_db_path = os.path.join("/", Loading @@ -60,8 +60,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "philo.db") # For Philo DB db_query = "SELECT id, (content || '<br> - ' || speaker) FROM quotes" \ "ORDER BY RANDOM() LIMIT 1" # For Philo DB db_query = "SELECT id, (content || '<br> - ' || speaker) FROM quotes \ ORDER BY RANDOM() LIMIT 1" # For Philo DB title_attr = "Philosophical Quotes DB" case 4: randmsg_db_path = os.path.join("/", Loading @@ -69,8 +69,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "hate.db") # For Hate DB db_query = """SELECT id, ("<font color='#FF0000'>" || comment) FROM hate_speech" \ "WHERE length(comment) <= 180 ORDER BY RANDOM() LIMIT 1""" db_query = """SELECT id, ("<font color='#FF0000'>" || comment) FROM hate_speech \ WHERE length(comment) <= 180 ORDER BY RANDOM() LIMIT 1""" title_attr = "Hate Speech DB" case 5: randmsg_db_path = os.path.join("/", Loading @@ -78,8 +78,8 @@ class RandMsg(FastAPI): "lib", "singerdbs", "rjokes.db") # r/jokes DB db_query = """SELECT id, (title || "<br>" || body) FROM jokes""" \ """WHERE score >= 10000 ORDER BY RANDOM() LIMIT 1""" db_query = """SELECT id, (title || "<br>" || body) FROM jokes \ WHERE score >= 10000 ORDER BY RANDOM() LIMIT 1""" title_attr = "r/jokes DB" case 6: randmsg_db_path = os.path.join("/", Loading
main.py +3 −7 Changes for main.py: 3 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ import importlib import logging from typing import Union, Any from fastapi import FastAPI, HTTPException, Response, Form from typing import Any from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware logger = logging.getLogger() Loading Loading @@ -33,12 +33,8 @@ Blacklisted routes def disallow_get(): return util.get_blocked_response() @app.get("/favicon.ico") def disallow_get(): return util.get_blocked_response() @app.get("/{any}") def disallow_get(any: Any): def disallow_get_any(var: Any): return util.get_blocked_response() @app.post("/") Loading