Github社区python项目数据分析引言使用API调用数据处理API响应利用pygal可视化受欢迎的github仓库项目源码
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]
信息如下:

其中我们可以或者,最受欢迎的项目名称为:awesome-
python,创建于2014年,截止到我写这篇博客时,依旧有更新,图片最后一行是对这个项目的描述:一组很棒的Python框架、库、软件和资源的列表。所以,这就是个各个python资料的链接中心。。。
# 利用pygal可视化受欢迎的github仓库
这里我们要创建一个交互式的条形图svg:条形图高度表示了项目获得了多少颗星。单击条形图还能跳转到项目在github上的主页。图片如下:

# 项目源码
github : [ 传送门 ](https://github.com/shawshany/pygal-webapi)

浙公网安备 33010602011771号