Python github 模块,BadCredentialsException() 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用github.BadCredentialsException()

项目:linty    作者:ZeroCater    | 项目源码 | 文件源码
def get(self, request, *args, **kwargs):
        g = get_github(self.request.user)
        try:
            repos = [r for r in g.get_user().get_repos()]
        except BadCredentialsException:
            UserSocialAuth.objects.filter(user=request.user).delete()
            return redirect(reverse('social:begin', args=['github'])) + '?next=' + request.path

        self.object_list = Repo.objects.filter(
            full_name__in=[i.full_name for i in repos],
            disabled=False
        ).annotate(builds_count=Count('builds'))

        names = [x.full_name for x in self.object_list]

        filtered = []
        for repo in repos:
            if repo.full_name not in names:
                filtered.append(repo)

        context = self.get_context_data()
        context['repos'] = filtered

        context['welcome'] = request.GET.get('welcome', False)

        return self.render_to_response(context)
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def testBadCredentials(self):
        self.assertRaises(github.BadCredentialsException, lambda: github.Github("BadUser", "BadPassword").get_user().login)
项目:TutLab    作者:KingsMentor    | 项目源码 | 文件源码
def testBadCredentials(self):
        self.assertRaises(github.BadCredentialsException, lambda: github.Github("BadUser", "BadPassword").get_user().login)
项目:skill-for-github    作者:dkavanagh    | 项目源码 | 文件源码
def testBadCredentials(self):
        self.assertRaises(github.BadCredentialsException, lambda: github.Github("BadUser", "BadPassword").get_user().login)
项目:fuzzinator    作者:renatahodovan    | 项目源码 | 文件源码
def login(self, username, pwd):
        try:
            self.gh = Github(username, pwd)
            # This expression has no effect but will throw an exception if the authentication failed.
            self.gh.get_user().id
            self.ghapi = self.gh.get_repo(self.repository)
            return True
        except BadCredentialsException:
            return False
项目:hudl-bugbounty    作者:lewislabs    | 项目源码 | 文件源码
def testBadCredentials(self):
        self.assertRaises(github.BadCredentialsException, lambda: github.Github("BadUser", "BadPassword").get_user().login)