From 9dc1ec3e7b427d57566488637546f3b57b96de64 Mon Sep 17 00:00:00 2001 From: ricardojdsilva87 Date: Mon, 28 Oct 2024 14:53:07 +0000 Subject: [PATCH] fix: api endpoint if ghe is not set --- auth.py | 2 +- contributor_stats.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/auth.py b/auth.py index 6d848d1..840d4eb 100644 --- a/auth.py +++ b/auth.py @@ -69,7 +69,7 @@ def get_github_app_installation_token( str: the GitHub App token """ jwt_headers = github3.apps.create_jwt_headers(gh_app_private_key_bytes, gh_app_id) - api_endpoint = f"{ghe}/api/v3" if ghe else "api.github.com" + api_endpoint = f"{ghe}/api/v3" if ghe else "https://api.github.com" url = f"{api_endpoint}/app/installations/{gh_app_installation_id}/access_tokens" try: diff --git a/contributor_stats.py b/contributor_stats.py index 4f553f0..7ddb36d 100644 --- a/contributor_stats.py +++ b/contributor_stats.py @@ -153,10 +153,10 @@ def get_sponsor_information(contributors: list, token: str, ghe: str) -> list: variables = {"username": contributor.username} # Send the GraphQL request - api_endpoint = f"{ghe}/api/v3" if ghe else "api.github.com" + api_endpoint = f"{ghe}/api/v3" if ghe else "https://api.github.com" headers = {"Authorization": f"Bearer {token}"} response = requests.post( - f"https://{api_endpoint}/graphql", + f"{api_endpoint}/graphql", json={"query": query, "variables": variables}, headers=headers, timeout=60,