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]

信息如下:
![这里写图片描述](https://img-
blog.csdn.net/20180118112509011?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMDY2NTIxNg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
其中我们可以或者,最受欢迎的项目名称为:awesome-
python,创建于2014年,截止到我写这篇博客时,依旧有更新,图片最后一行是对这个项目的描述:一组很棒的Python框架、库、软件和资源的列表。所以,这就是个各个python资料的链接中心。。。

# 利用pygal可视化受欢迎的github仓库

这里我们要创建一个交互式的条形图svg:条形图高度表示了项目获得了多少颗星。单击条形图还能跳转到项目在github上的主页。图片如下:
![这里写图片描述](https://img-
blog.csdn.net/20180118113922462?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMDY2NTIxNg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)

# 项目源码

github : [ 传送门 ](https://github.com/shawshany/pygal-webapi)


![在这里插入图片描述](https://img-blog.csdnimg.cn/20210608151750993.gif)

posted on 2021-06-28 21:51  BabyGo000  阅读(130)  评论(0)    收藏  举报