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?
On GitHub.com, navigate to the main page of the repository. Under your repository name, click Insights. In the left sidebar, click Contributors. Optionally, to view contributors during a specific time period, click, then drag until the time period is selected.
How To List All Public Repositories Belonging to a User? So, to list all public repos from a user, send a GET request to https://api.github.com/users/<USER-NAME>/repos , replacing with the actual user from whom you want to retrieve the repositories.
Go here: https://github.com/search and enter "pattern repo:user_name/repo_name". because by default it searches for repositories matching that search string... So just click on the left on "Code" and it will display what you want.
You can see the repositories where you're a collaborator. To do this, head to the Repositories section of your account's settings (https://github.com/settings/repositories). There should be a Leave action button aside each repository you're a collaborator on.
You can take an example 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()
It is based on the GitHub API mentioned in "How to retrieve the list of all github repositories of a person?":
/users/:user/repos
(public repos only)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With