使用Python的pygithub3获取存储库信息 [英] Getting repository information using pygithub3 for Python

查看:486
本文介绍了使用Python的pygithub3获取存储库信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Github用户名访问每个存储库中使用的语言。为了做到这一点,到目前为止我的Python代码是:

I'm trying to access the language used in each repository given a Github username. In order to do this, so far my python code is:

from pygithub3 import Github

username = raw_input("Please enter a Github username: ")
password = raw_input("Please enter the account password: ")

gh = Github(login=username, password = password)

get_user = gh.users.get()

user_repos = gh.repos.list().all().language

print user_repos

但是,list对象显然没有任何语言属性,所以我不知道如何访问该信息。有没有人有任何帮助?

However, the list object apparently doesn't have any language attribute, so I don't know how to access that information. Does anyone have any help?

推荐答案

试试这个人,它为我工作:

Try this man, it worked for me:

from pygithub3 import Github

username = raw_input("Please enter a Github username: ")
password = raw_input("Please enter the account password: ")

gh = Github(login=username, password = password)

get_user = gh.users.get()

user_repos = gh.repos.list().all()

for repo in user_repos:
    print repo.language

这篇关于使用Python的pygithub3获取存储库信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆