Skip to content

Commit

Permalink
Properly set GitHub token when getting previous checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
Aareon Sullivan committed Sep 18, 2024
1 parent 1a0408b commit 56d7f56
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions update_allCountries.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from datetime import datetime, timezone
from pathlib import Path
import time
import os

from tqdm import tqdm
import httpx
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 56d7f56

Please sign in to comment.