标签:== exception final one 实现 hub repo 根据 nal
条件:
language:python commits:>100 contributors:>2 stars:>5 fork:0
实现:
from github import Github access_token = ‘your_token‘ gh = Github(access_token) def search_repositories(q): try: repos=gh.search_repositories(query=q) except Exception, e: return None return repos if __name__ == ‘__main__‘: q = "language:Python forks:0 stars:>5" repos=search_repositories(q) min_num_of_commits=100 min_num_of_contributors = 2 final_repos=[] for repo in repos: num_of_commits=len(list(repo.get_commits())) num_of_contributors=len(list(repo.get_contributors())) if num_of_commits>min_num_of_commits and num_of_contributors>min_num_of_contributors: final_repos.append(repo) print ‘name : ‘, repo.name print ‘html_url : ‘, repo.html_url print ‘url : ‘, repo.url print ‘#commits : ‘, num_of_commits print ‘#contributors : ‘, num_of_contributors
标签:== exception final one 实现 hub repo 根据 nal
原文地址:http://www.cnblogs.com/XBWer/p/7988599.html