-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_repos.py
More file actions
31 lines (25 loc) · 1.14 KB
/
Copy pathpython_repos.py
File metadata and controls
31 lines (25 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import requests
# Realiza una llamada ala API y verifica la respuesta
url = "https://api.github.com/search/repositories"
url += "?q=language:python+sort:stars+stars:>10000"
headers = {"Accept": "application/vnd.github.v3+json"}
r = requests.get(url, headers=headers)
print(f"Status code: {r.status_code}")
# Convierte el objeto de respuesta en un diccionario
response_dict = r.json()
print(f"Total repositorios: {response_dict['total_count']}")
print(f"Resultados completos: {not response_dict['incomplete_results']}")
# Explora la información sobre los repositorios
repo_dicts = response_dict["items"]
print(f"Repositorios devueltos: {len(repo_dicts)}")
# Examina el primer repositorio
repo_dict = repo_dicts[0]
print("\nSelecciona información sobre cada repositorio")
for repo_dict in repo_dicts:
print(f"Nombre: {repo_dict['name']}")
print(f"Propietario: {repo_dict['owner']['login']}")
print(f"Stars: {repo_dict['stargazers_count']}")
print(f"Repositorio: {repo_dict['html_url']}")
print(f"Creado: {repo_dict['created_at']}")
print(f"Actualizado: {repo_dict['updated_at']}")
print(f"Descripción: {repo_dict['description']}")