Skip to content

Commit

Permalink
Merge a3c96d2 into 308d39b
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed May 23, 2021
2 parents 308d39b + a3c96d2 commit b93e0af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pydis_site/apps/home/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.views import View

from pydis_site.apps.home.models import RepositoryMetadata
from pydis_site.constants import GITHUB_TOKEN

log = logging.getLogger(__name__)

Expand All @@ -18,6 +19,7 @@ class HomeView(View):

github_api = "https://api.github.com/users/python-discord/repos?per_page=100"
repository_cache_ttl = 3600
headers = {"Authorization": f"token {GITHUB_TOKEN}"}

# Which of our GitHub repos should be displayed on the front page, and in which order?
repos = [
Expand All @@ -42,7 +44,7 @@ def _get_api_data(self) -> Dict[str, Dict[str, str]]:
repo_dict = {}

# Fetch the data from the GitHub API
api_data: List[dict] = requests.get(self.github_api).json()
api_data: List[dict] = requests.get(self.github_api, headers=self.headers).json()

# Process the API data into our dict
for repo in api_data:
Expand Down
1 change: 1 addition & 0 deletions pydis_site/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os

GIT_SHA = os.environ.get("GIT_SHA", "development")
GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN")

0 comments on commit b93e0af

Please sign in to comment.