diff options
author | 2022-07-09 22:27:11 +0400 | |
---|---|---|
committer | 2022-07-11 04:17:42 +0400 | |
commit | c24ccccde65cd8d5601ade63e47f2167ba64b5ee (patch) | |
tree | 9909f7faf3d88f86fddc98d179152b9d03585e2b /pydis_site/apps/home/views | |
parent | Merge #722 - resources: add The Algorithms and remove Atom (diff) |
Switch Out requests For httpx
The requests library has been replaced by httpx. It's a drop-in
replacement, but provides a better interface for certain things,
such as client sessions, and sync/async support.
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'pydis_site/apps/home/views')
-rw-r--r-- | pydis_site/apps/home/views/home.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pydis_site/apps/home/views/home.py b/pydis_site/apps/home/views/home.py index 69e706c5..9bb1f8fd 100644 --- a/pydis_site/apps/home/views/home.py +++ b/pydis_site/apps/home/views/home.py @@ -1,7 +1,7 @@ import logging from typing import Dict, List -import requests +import httpx from django.core.handlers.wsgi import WSGIRequest from django.http import HttpResponse from django.shortcuts import render @@ -56,12 +56,12 @@ class HomeView(View): repo_dict = {} try: # Fetch the data from the GitHub API - api_data: List[dict] = requests.get( + api_data: List[dict] = httpx.get( self.github_api, headers=self.headers, timeout=settings.TIMEOUT_PERIOD ).json() - except requests.exceptions.Timeout: + except httpx.TimeoutException: log.error("Request to fetch GitHub repository metadata for timed out!") return repo_dict |