aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2020-03-18 21:11:42 +0100
committerGravatar kwzrd <[email protected]>2020-03-18 21:11:42 +0100
commit7e3dd1eb73a080a87e360afe5488354eea6b8498 (patch)
tree5f6ca25b86a914f9e283744858b3de31ff2fd625
parentDeseasonify: add github token env var (diff)
Deseasonify: authorize with github token
It is not critical that a token is provided, as the target repository is public. However, if a token is provided, let's use it.
-rw-r--r--bot/branding.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/bot/branding.py b/bot/branding.py
index 8489af8a..bc0908b0 100644
--- a/bot/branding.py
+++ b/bot/branding.py
@@ -9,7 +9,7 @@ import discord
from discord.ext import commands
from bot.bot import SeasonalBot
-from bot.constants import Client, MODERATION_ROLES
+from bot.constants import Client, MODERATION_ROLES, Tokens
from bot.decorators import with_role
from bot.seasons import SeasonBase, get_current_season, get_season
@@ -22,8 +22,11 @@ SERVER_ICONS = "server_icons"
BRANDING_URL = "https://api.github.com/repos/python-discord/branding/contents"
-HEADERS = {"Accept": "application/vnd.github.v3+json"} # Ensure we use API v3
PARAMS = {"ref": "seasonal-structure"} # Target branch
+HEADERS = {"Accept": "application/vnd.github.v3+json"} # Ensure we use API v3
+
+if Tokens.github:
+ HEADERS["Authorization"] = f"token {Tokens.github}"
class GithubFile(t.NamedTuple):