From 7d82db05cac8d67bb6642a013174b05c49f0556f Mon Sep 17 00:00:00 2001 From: cmyui Date: Mon, 1 Jul 2024 13:39:18 -0400 Subject: [PATCH] Add support for increased mino ratelimit via confidential key --- app/adapters/osu_mirrors/backends/mino.py | 2 ++ app/settings.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/adapters/osu_mirrors/backends/mino.py b/app/adapters/osu_mirrors/backends/mino.py index 6395584..e6a4e9c 100644 --- a/app/adapters/osu_mirrors/backends/mino.py +++ b/app/adapters/osu_mirrors/backends/mino.py @@ -3,6 +3,7 @@ import httpx from typing_extensions import override +from app import settings from app.adapters.osu_mirrors.backends import AbstractBeatmapMirror from app.adapters.osu_mirrors.backends import BeatmapMirrorResponse from app.repositories.beatmap_mirror_requests import MirrorResource @@ -22,6 +23,7 @@ async def fetch_beatmap_zip_data( try: response = await self.http_client.get( f"{self.base_url}/d/{beatmapset_id}", + headers={"x-ratelimit-key": settings.MINO_INCREASED_RATELIMIT_KEY}, timeout=httpx.Timeout(None, connect=2), ) if response.status_code == 404: diff --git a/app/settings.py b/app/settings.py index ff7e77f..c97d79d 100644 --- a/app/settings.py +++ b/app/settings.py @@ -33,3 +33,5 @@ def read_bool(s: str) -> bool: AWS_S3_SECRET_ACCESS_KEY = os.environ["AWS_S3_SECRET_ACCESS_KEY"] DISCORD_BEATMAP_UPDATES_WEBHOOK_URL = os.environ["DISCORD_BEATMAP_UPDATES_WEBHOOK_URL"] + +MINO_INCREASED_RATELIMIT_KEY = os.environ["MINO_INCREASED_RATELIMIT_KEY"]