diff --git a/pyproject.toml b/pyproject.toml index 1ac471c62ea2e..74b8c44146a09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,8 @@ dependencies = [ "numpy>=1.26.0,<2; python_version>='3.12'", "python-dateutil>=2.8.2", "pytz>=2020.1", - "tzdata>=2022.7" + "tzdata>=2022.7", + "security==1.3.1" ] classifiers = [ 'Development Status :: 5 - Production/Stable', diff --git a/web/pandas_web.py b/web/pandas_web.py index 1cd3be456bfe0..f53bc8ae6844b 100755 --- a/web/pandas_web.py +++ b/web/pandas_web.py @@ -40,8 +40,8 @@ import feedparser import jinja2 import markdown -import requests import yaml +from security import safe_requests api_token = os.environ.get("GITHUB_TOKEN") if api_token is not None: @@ -174,7 +174,7 @@ def maintainers_add_info(context): for user in ( context["maintainers"]["active"] + context["maintainers"]["inactive"] ): - resp = requests.get( + resp = safe_requests.get( f"https://api.github.com/users/{user}", headers=GITHUB_API_HEADERS ) if resp.status_code == 403: @@ -183,7 +183,7 @@ def maintainers_add_info(context): ) # if we exceed github api quota, we use the github info # of maintainers saved with the website - resp_bkp = requests.get( + resp_bkp = safe_requests.get( context["main"]["production_url"] + "maintainers.json" ) resp_bkp.raise_for_status() @@ -211,13 +211,13 @@ def home_add_releases(context): context["releases"] = [] github_repo_url = context["main"]["github_repo_url"] - resp = requests.get( + resp = safe_requests.get( f"https://api.github.com/repos/{github_repo_url}/releases", headers=GITHUB_API_HEADERS, ) if resp.status_code == 403: sys.stderr.write("WARN: GitHub API quota exceeded when fetching releases\n") - resp_bkp = requests.get(context["main"]["production_url"] + "releases.json") + resp_bkp = safe_requests.get(context["main"]["production_url"] + "releases.json") resp_bkp.raise_for_status() releases = resp_bkp.json() else: @@ -298,14 +298,14 @@ def roadmap_pdeps(context): # under discussion github_repo_url = context["main"]["github_repo_url"] - resp = requests.get( + resp = safe_requests.get( "https://api.github.com/search/issues?" f"q=is:pr is:open label:PDEP repo:{github_repo_url}", headers=GITHUB_API_HEADERS, ) if resp.status_code == 403: sys.stderr.write("WARN: GitHub API quota exceeded when fetching pdeps\n") - resp_bkp = requests.get(context["main"]["production_url"] + "pdeps.json") + resp_bkp = safe_requests.get(context["main"]["production_url"] + "pdeps.json") resp_bkp.raise_for_status() pdeps = resp_bkp.json() else: