def authorizedGit(oauth_token): if oauth_token is None: flash("Authorization failed.") return redirect(url_for('index')) g = git(oauth_token) user = g.get_user() userData = { "email": user.get_emails()[0]['email'], "name": user.login, "picture": user.avatar_url } print(type(userData)) session['user'] = userData checkForUser() return userData
def auth_git(): return git(properties.get('GITHUB_USERNAME'), properties.get('GITHUB_PASSWORD'), timeout=3000)
# for i in p_t: # a+=str(i[5]['name'])+ ' {: <55}\t'.format(i[1])+' {: <13}\t'.format(i[2])+'https://chromeriver.atlassian.net/browse/{}'.format(i[4] if i[4] else 'no jira link in PR')+'\n' return a devs = [ 'vpetryk', 'aivanochko', 'tkhoma', 'aromaniv', 'dhorohotskyi', 'oziniak', 'vlevytskyi', 'tommywoo916', 'alliecr' ] repos = [ 'mercury', 'tessera-web', 'tessera', 'tessera-validation', 'disney', 'analytics', 'customer', 'tessera-libraries' ] tkn = os.environ.get('g_tkn', None) g = git(tkn) ch = g.get_organization('Chrome-River') ju = os.environ.get('j_u', None) jp = os.environ.get('j_p', None) j = JIRA('https://chromeriver.atlassian.net', basic_auth=(ju, jp)) nt = r'needs testing|ready for retesting' nrt = r'needs retesting' t = r'tested' tip = r'testing in progress' reop = r'reopen|blocker' rep = [ch.get_repo(i) for i in repos] pulls = [[
# import json from github import Github as git import csv g = git("username", "password") lang_code = {} for repo in g.get_user().get_repos(): # print(json.dumps(repo.raw_data, separators=(',', ':'), indent=4)) # print("1", repo.name) # print("2", repo.description) # print("3", repo.language) # print("4", repo.size) # print("5", repo.get_languages()) # print() langs = repo.get_languages() for lang in langs: if lang in lang_code: lang_code[lang] += langs[lang] else: lang_code[lang] = langs[lang] lang_code["Python"] -= 23746 for lang in ["PHP", "CSS", "JavaScript"]: lang_code.pop(lang)
from github import Github as git from github import GithubException g_login = git("<USER_NAME>", "<PASSWORD>") x = 0 total_stars = 0 for repo in g_login.get_user().get_repos(): try: print("In the " + str(repo.name) + " repo, the total no. of stars is " + str(repo.stargazers_count)) print("traffic " + str(repo.get_views_traffic())) total_stars += repo.stargazers_count x += 1 except GithubException: print("") print("total repo is " + str(x)) print("Total stars is :- " + str(total_stars))