From 56d7f56a3ac14473440a81cdc1344f5026fc1d9a Mon Sep 17 00:00:00 2001 From: Aareon Sullivan Date: Tue, 17 Sep 2024 19:09:05 -0500 Subject: [PATCH] Properly set GitHub token when getting previous checksum --- update_allCountries.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/update_allCountries.py b/update_allCountries.py index befe467..fe21d8d 100644 --- a/update_allCountries.py +++ b/update_allCountries.py @@ -6,6 +6,7 @@ from datetime import datetime, timezone from pathlib import Path import time +import os from tqdm import tqdm import httpx @@ -112,10 +113,18 @@ def create_release_notes(stats, is_update): """ async def get_previous_checksum(): + GITHUB_API_URL = "https://api.github.com/repos/Aareon/GeoNamesMirror/releases" + GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") + + if not GITHUB_TOKEN: + logger.error("GITHUB_TOKEN environment variable is not set.") + return None + try: async with httpx.AsyncClient() as client: response = await client.get(GITHUB_API_URL, headers={ "Accept": "application/vnd.github+json", + "Authorization": f"Bearer {GITHUB_TOKEN}", "X-GitHub-Api-Version": "2022-11-28" }) response.raise_for_status()