aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2022-02-25 01:09:58 +0100
committerGravatar Johannes Christ <[email protected]>2022-02-26 13:32:45 +0100
commit7f617657068e2cf877edfb06a70d435dd5dfbdc0 (patch)
tree28d7dec1e75a6d5197d7c6a7d3d2319efbdca096 /pydis_site/apps
parentRemove unused module (diff)
Remove and merge superfluous modules
The constants module more or less did what belongs to the settings.
Diffstat (limited to 'pydis_site/apps')
-rw-r--r--pydis_site/apps/home/views/home.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pydis_site/apps/home/views/home.py b/pydis_site/apps/home/views/home.py
index e28a3a00..dafe32c0 100644
--- a/pydis_site/apps/home/views/home.py
+++ b/pydis_site/apps/home/views/home.py
@@ -2,6 +2,7 @@ import logging
from typing import Dict, List
import requests
+from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponse
from django.shortcuts import render
@@ -10,7 +11,6 @@ from django.views import View
from pydis_site import settings
from pydis_site.apps.home.models import RepositoryMetadata
-from pydis_site.constants import GITHUB_TOKEN, TIMEOUT_PERIOD
log = logging.getLogger(__name__)
@@ -43,8 +43,8 @@ class HomeView(View):
# specifically, GitHub will reject any requests from us due to the
# invalid header. We can make a limited number of anonymous requests
# though, which is useful for testing.
- if GITHUB_TOKEN:
- self.headers = {"Authorization": f"token {GITHUB_TOKEN}"}
+ if settings.GITHUB_TOKEN:
+ self.headers = {"Authorization": f"token {settings.GITHUB_TOKEN}"}
else:
self.headers = {}
@@ -60,7 +60,7 @@ class HomeView(View):
api_data: List[dict] = requests.get(
self.github_api,
headers=self.headers,
- timeout=TIMEOUT_PERIOD
+ timeout=settings.TIMEOUT_PERIOD
).json()
except requests.exceptions.Timeout:
log.error("Request to fetch GitHub repository metadata for timed out!")