Skip to content

Commit

Permalink
fix: fix api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardojdsilva87 committed Oct 28, 2024
1 parent 9dc1ec3 commit 3b6a323
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions contributor_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ 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 "https://api.github.com"
api_endpoint = (
f"{ghe}/api/v3".removeprefix("https://") if ghe else "api.github.com"
)
headers = {"Authorization": f"Bearer {token}"}
response = requests.post(
f"{api_endpoint}/graphql",
f"https://{api_endpoint}/graphql",
json={"query": query, "variables": variables},
headers=headers,
timeout=60,
Expand Down
2 changes: 1 addition & 1 deletion contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def get_contributors(repo: object, start_date: str, end_date: str, ghe: str):
continue

# Store the contributor information in a ContributorStats object
api_endpoint = ghe if ghe else "github.com"
api_endpoint = ghe.removeprefix("https://") if ghe else "github.com"
if start_date and end_date:
commit_url = f"https://{api_endpoint}/{repo.full_name}/commits?author={user.login}&since={start_date}&until={end_date}"
else:
Expand Down

0 comments on commit 3b6a323

Please sign in to comment.