Created
July 27, 2023 20:36
-
-
Save wangkuiyi/d1939bfaf5541e74b85efa660b769b89 to your computer and use it in GitHub Desktop.
get_repo for GitHub (Enterprise) using requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import os | |
from pprint import pprint | |
# The GitHub API get_repo | |
# - for Free/Pro/Teams: https://docs.github.com/en/free-pro-team@latest/rest/repos/repos?apiVersion=2022-11-28#get-a-repository | |
# - for Enterprise/Cloud: https://docs.github.com/en/enterprise-cloud@latest/rest/repos/repos?apiVersion=2022-11-28#get-a-repository | |
# | |
token = os.getenv('GITHUB_TOKEN') | |
owner = "ywang999828" | |
repo = "flaxiree" | |
query_url = f"https://github.pie.apple.com/api/v3/repos/{owner}/{repo}" | |
headers = {'Authorization': f'token {token}'} | |
r = requests.get(query_url, headers=headers) | |
pprint(r.json()["name"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment