本文介绍了我如何在github中找到用户参与的所有公共回购协议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using the github3 python library and am trying to find all public repos that users from our organization have contributed to (to reward the support of open source!).
I've got the list of users for the organization, but now what?
Can I use the public events iterator to find repos?

#!/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?  

推荐答案

您可以举一个例子 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 如何检索一个人的所有github存储库的列表?:

/users/:user/repos

(仅公共存储库)

这篇关于我如何在github中找到用户参与的所有公共回购协议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 18:43