def with_organization_repos(repos): all_repos = {r['id']: r for r in repos} # index by id orgs = github.get('user/orgs') orgs_names = [o['login'] for o in orgs] for org_name in orgs_names: org_repos = github.get('orgs/%s/repos' % org_name) for repo in org_repos: all_repos[repo['id']] = repo # add each repo for each org. all_repos = all_repos.values() all_repos.sort(key=operator.itemgetter('full_name')) return all_repos
def repos(): repos = github.get('user/repos') repos = with_organization_repos(repos) selected_ids = [r.github_id for r in g.user.repos] for repo in repos: repo['checked'] = (repo['id'] in selected_ids) return render_template('repos.html', repos=repos)
def get_repos(): repos = github.get('user/repos', params=list_params) repos = with_organization_repos(repos) selected_ids = [r.github_id for r in g.user.repos] for repo in repos: repo['checked'] = (repo['id'] in selected_ids) # list only python projects repos = [r for r in repos if str(r.get('language')).lower() == 'python'] return render_template('repos.html', repos=repos)
def get_repos(): repos = github.get('user/repos', params=list_params) repos = with_organization_repos(repos) selected_ids = [r.github_id for r in g.user.repos] for repo in repos: repo['checked'] = (repo['id'] in selected_ids) # list only python projects repos = [ r for r in repos if str(r.get('language')).lower() == 'python' ] return render_template('repos.html', repos=repos)
def get_user(): return str(github.get('user'))
def get_emails_from_github(self): params = {'access_token': self.github_token} headers = {'Accept': 'application/vnd.github.v3'} emails = github.get('user/emails', params=params, headers=headers) return [e for e in emails if e['verified']]
def user(): return str(github.get('user'))