From b17cfd46eb53cb9842741efe9c02d6da7c2ba87d Mon Sep 17 00:00:00 2001 From: Luna Mendes Date: Sat, 3 Nov 2018 22:48:36 -0300 Subject: [PATCH] run: add dummy ratelimiting handler --- litecord/ratelimits/main.py | 5 +++++ run.py | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 litecord/ratelimits/main.py diff --git a/litecord/ratelimits/main.py b/litecord/ratelimits/main.py new file mode 100644 index 0000000..4ab71d6 --- /dev/null +++ b/litecord/ratelimits/main.py @@ -0,0 +1,5 @@ +from quart import current_app as app, request + +async def ratelimit_handler(): + # dummy handler for future code + print(request.headers) diff --git a/run.py b/run.py index 6f9f748..195aa0c 100644 --- a/run.py +++ b/run.py @@ -15,6 +15,8 @@ from litecord.blueprints import ( voice, invites, relationships, dms ) +from litecord.ratelimits.main import ratelimit_handler + # those blueprints are separated from the "main" ones # for code readability if people want to dig through # the codebase. @@ -87,6 +89,11 @@ for bp, suffix in bps.items(): app.register_blueprint(bp, url_prefix=f'/api/v6{suffix}') +@app.before_request +async def app_before_request(): + await ratelimit_handler() + + @app.after_request async def app_after_request(resp): origin = request.headers.get('Origin', '*')