[Python] Why I got Exception "403 Repository access blocked'' using pygithub?

Discussão em 'Python' iniciado por Stack, Março 19, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to scrapy github users' favorite programming language through pygithub,but so strange,every time I want to scrapy user--ELLIOTTCABLE' reposity i got following Exception:

    Traceback (most recent call last):
    File "/home/gf/KuaiPan/code/Python/Data Mining/test.py", line 14, in <module>
    repo = user.get_repo(j)
    File "/usr/lib/python3.4/site-packages/github/NamedUser.py", line 449, in get_repo
    "/repos/" + self.login + "/" + name
    File "/usr/lib/python3.4/site-packages/github/Requester.py", line 169, in requestJsonAndCheck
    return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx))
    File "/usr/lib/python3.4/site-packages/github/Requester.py", line 177, in __check
    raise self.__createException(status, responseHeaders, output)
    github.GithubException.GithubException: 403 {'message': 'Repository access blocked', 'block': {'reason': 'unavailable', 'created_at': '2014-01-31T14:32:14-08:00'}}


    My python code is below:

    #!/usr/bin/env python3
    from github import Github


    ACCESS_TOKEN = 'my credential'
    client = Github(ACCESS_TOKEN, per_page=100)
    user = client.get_user('ELLIOTTCABLE')
    repo_list = [repo.name for repo in user.get_repos() if not repo.fork]
    print(repo_list)

    for j in repo_list:
    repo = user.get_repo(j)
    lang = repo.language
    print(j,':',lang)

    Continue reading...

Compartilhe esta Página