Py学习  »  Git

pygithub:无法访问我的团队的私有存储库

Tjs01 • 4 年前 • 199 次点击  

我想访问我所属团队的私有存储库。但是,我无法访问它。它抛出一个异常,如下所示:

UnknownObjectException: 404 {u'documentation_url': u'https://developer.github.com/v3/repos/#list-teams', u'message': u'Not Found'}

我的代码:

from github import Github
import pandas as pd


git = Github("token")
org = git.get_organization('org')

org.get_repo('repo_name')

它在上面的语句中抛出n个错误。

我想访问这个存储库并获取有权访问该存储库的团队的数量。但是,在上述代码的最后一行出现了上述错误。

有人能帮我修一下吗?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/46594
 
199 次点击  
文章 [ 2 ]  |  最新文章 4 年前
mohit sehrawat
Reply   •   1 楼
mohit sehrawat    4 年前

对于Github Enterprise:

from github import Github  

g = Github(base_url="https://your_host_name/api/v3", login_or_token="your_access_token") 
org = g.get_organization("your_org")  
repo = org.get_repo(repo_name)   # getting the repo 
print(repo)

对于Github:

from github import Github  

g = Github(username,password)) 
repo = g.get_repo(repo_name)   # getting the repo 
print(repo)
qloveshmily
Reply   •   2 楼
qloveshmily    4 年前

使用哪个回购名称?

示例:team_x/repo_1

如果直接使用github(): repo = github().get_repo("team_X/repo_1")

如果使用org对象获取repo: repo = org.get_repo("repo_1")