Spaces:
Runtime error
Runtime error
| import requests | |
| GITHUB_TOKEN = "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" | |
| GITHUB_API_URL = "https://api.github.com" | |
| def get_repo_code(repo_link): | |
| # Extract repository owner and name from link | |
| owner, repo = repo_link.split("/")[-2:] | |
| repo_url = f"{GITHUB_API_URL}/repos/{owner}/{repo}/contents" | |
| # Send request to GitHub API | |
| headers = {"Authorization": f"Bearer {GITHUB_TOKEN}"} | |
| response = requests.get(repo_url, headers=headers) | |
| # Return repository code files | |
| return response.json() |