Create src/github_analysis.py python Copy Edit
Browse files
src/github_analysis.py python Copy Edit
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import logging
|
| 3 |
+
|
| 4 |
+
def analyze_repository(owner, repo_name):
|
| 5 |
+
try:
|
| 6 |
+
url = f"https://api.github.com/repos/{owner}/{repo_name}"
|
| 7 |
+
response = requests.get(url)
|
| 8 |
+
response.raise_for_status()
|
| 9 |
+
|
| 10 |
+
repo_data = response.json()
|
| 11 |
+
logging.info(f"Analyzing repository: {repo_name}")
|
| 12 |
+
logging.info(f"Description: {repo_data['description']}")
|
| 13 |
+
logging.info(f"Stars: {repo_data['stargazers_count']}")
|
| 14 |
+
|
| 15 |
+
except requests.exceptions.RequestException as e:
|
| 16 |
+
logging.error(f"Failed to fetch data for {repo_name}: {e}")
|