gpt4 book ai didi

python - 我如何在 github 中找到用户贡献的所有公共(public) repo ?

转载 作者:太空狗 更新时间:2023-10-30 00:14:51 25 4
gpt4 key购买 nike

我正在使用 github3 python library并试图找到我们组织的用户贡献的所有公共(public) repo (以奖励对开源的支持!)。
我已经获得了组织的用户列表,但现在呢?
我可以使用公共(public)事件迭代器查找存储库吗?

#!/usr/bin/env python
import argparse
import github3


def get_organization(github, name):
for organization in github.iter_orgs():
if organization.login == name:
return organization


def main(args):
github = github3.login(args.github_username, password=args.github_password)
organization = get_organization(github, args.organization)

# Get a list of all current organization contributors
orgMembers = [member.login for member in organization.iter_members()]

# now what?

最佳答案

可以举个例子of test_github.py :

def test_iter_user_repos(self):
self.response('repo', _iter=True)
self.get('https://api.github.com/users/sigmavirus24/repos')
self.conf.update(params={'type': 'all', 'direction': 'desc'})

next(self.g.iter_user_repos('sigmavirus24', 'all', direction='desc'))
self.mock_assertions()

self.conf.update(params={"sort": "created"})
self.get('https://api.github.com/users/sigmavirus24/repos')

assert isinstance(next(self.g.iter_user_repos('sigmavirus24', sort="created")),
github3.repos.Repository)
self.mock_assertions()

它基于 GitHub API在“How to retrieve the list of all github repositories of a person?”中提到:

/users/:user/repos

(仅限公共(public) repo )

关于python - 我如何在 github 中找到用户贡献的所有公共(public) repo ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18711121/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com