def do_login(self): username, password = utils.get_cred(self.options, source='github') g = Github(username, password) try: _ = g.get_emojis() return g except: utils.print_bad(f"Login fail as {username}") return False
from pprint import pprint from github import Github, InputFileContent GITHUB_TOKEN = os.environ['GITHUB_TOKEN'] code = """ Repo = namedtuple('Repo', 'name stars forks') from collections import namedtuple def get_repo_stats(user, n=5): repos = [] for repo in user.get_repos(): if repo.fork: continue repos.append(Repo(repo.name, repo.stargazers_count, repo.forks_count)) return sorted(repos, key=lambda x: x.stars, reverse=True)[:n] """ if __name__ == '__main__': gh = Github(GITHUB_TOKEN) pb = gh.get_user() print(pb.name) repos = pb.get_repos() # print(get_repo_stats(pb)) print(gh.rate_limiting) gist = pb.create_gist(True, {"repo_stats.py": InputFileContent(code)}, "Get GH user's most popular repos") print(gist) print(help(gh.get_emojis())) # print(help(pb.create_gist))
from github import Github from github_token import GITHUB_TOKEN, user, password g1 = Github(GITHUB_TOKEN) g2 = Github(user, password) #Lists all the emojis available to use on GitHub #https://developer.github.com/v3/emojis/ emojis = g1.get_emojis() for emoji in emojis: print(emoji)