#!/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)
403HTTP状态表示禁止请求,因此您提供的凭据无法让您访问某些端点。
因此,在创建
Github
):
#!/usr/bin/env python3
from github import Github
ACCESS_USERNAME = 'username'
ACCESS_PWD = "password"
client = Github(ACCESS_USERNAME, ACCESS_PWD, 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)
这应该很好。
如果您尝试访问由于DMCA
取下的存储库,则此错误消息还显示在Node.js Octokit上 这可能与原始问题无关,但是错误消息是相同的,因此希望它可以帮助像我这样的未来Google。 我已经在:https://github.com/orgs/community/discussions/154227中描述了我的调查,但长话短说,我是从官方的github node.js api请求中做的,例如:
const commits = await octokit.rest.repos.listCommits({
owner: 'duty-machine',
repo: 'news',
per_page: 1,
})