r = requests.get(url)
# In[11]:
print("Status code:",r.status_code)
# In[12]:
response_dict = r.json()
# In[14]:
print(response_dict.keys())
# In[15]:
print("Total repositories:", response_dict['total_count'])
# In[16]:
# Explore information about the repositories.
repo_dicts = response_dict['items']
print("Repositories returned:",len(repo_dicts))
# In[17]:
repo_dict = repo_dicts[0]
print("\nKeys:",len(repo_dict))
for key in sorted(repo_dict.keys()):
print(key)
# In[18]:
print("\nSelected information about first repository:")
print('Name:',repo_dict['name'])
print('Owner:',repo_dict['owner']['login'])
print('Stars:',repo_dict['stargazers_count'])
print('Repository:',repo_dict['html_url'])
print('Created:',repo_dict['created_at'])
print('Updated:',repo_dict['updated_at'])
print('Description:',repo_dict['description'])
[/code]
信息如下:
![这里写图片描述](https://img-
blog.csdn.net/20180118112509011?/gravity/SouthEast)
其中我们可以或者,最受欢迎的项目名称为:awesome-
python,创建于2014年,截止到我写这篇博客时,依旧有更新,图片最后一行是对这个项目的描述:一组很棒的Python框架、库、软件和资源的列表。所以,这就是个各个python资料的链接中心。。。
# 利用pygal可视化受欢迎的github仓库
这里我们要创建一个交互式的条形图svg:条形图高度表示了项目获得了多少颗星。单击条形图还能跳转到项目在github上的主页。图片如下:
![这里写图片描述](https://img-
blog.csdn.net/20180118113922462?/gravity/SouthEast)
# 项目源码
github : [ 传送门 ](https://github.com/shawshany/pygal-webapi)
![在这里插入图片描述](https://www.www.zyiz.net/i/ll/?i=20210608151750993.gif)