Skip to content

Commit d992b5e

Browse files
onerandomusernamejb3
authored andcommitted
feat: include GitHub token in headers if available
Add GitHub authorization header using token from Keys.
1 parent 8fdc370 commit d992b5e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bot/exts/info/code_snippets.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from discord.ext.commands import Cog
1111

1212
from bot.bot import Bot
13-
from bot.constants import Channels
13+
from bot.constants import Channels, Keys
1414
from bot.log import get_logger
1515
from bot.utils.messages import wait_for_deletion
1616

@@ -28,6 +28,8 @@
2828
)
2929

3030
GITHUB_HEADERS = {"Accept": "application/vnd.github.v3.raw"}
31+
if Keys.github:
32+
GITHUB_HEADERS["Authorization"] = f"token {Keys.github}"
3133

3234
GITLAB_RE = re.compile(
3335
r"https://gitlab\.com/(?P<repo>[\w.-]+/[\w.-]+)/\-/blob/(?P<path>[^#>]+)"

0 commit comments

Comments
 (0)