问题描述
在使用 PyGithub 库在 OAuth 中授权用户时,我无法找到请求“repo”范围的方法。
我的团队正在构建一个“代码库分析器”网站,该网站可提供有关所选代码库中代码的见解。我们正在使用 Git API 的 PyGithub 实现。我们正在使用 OAuth 来授权用户,它非常适用于公共存储库。但是,我无法成功指定范围。我尝试了下面的“Github.oauth_scopes”,这显然是错误的。非常感谢任何提示!
在截图中可以看到 OAuth 只是请求公共数据,我们也需要提示访问私有存储库,这意味着使用“repo”范围:GitApiScopeDoc
from github import *
g = Github()
#request repo scope
Github.oauth_scopes = "repo"
#authorization using oauth
clientID = "enterclientidhere"
secret = "entersecrethere"
oauth = g.get_oauth_application(clientID,secret)
url = oauth.get_login_url()
#print the url,then we follow the url to github which requests a users identity
print(url)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)