pygithub - pygithub - 如何创建检查运行?
问题描述
我正在尝试在 github 中创建一个检查运行(参考:)
import jwt
import time
from github import Github
pem_file = "ci-results.2020-11-27.private-key.pem"
installation_id = 13221707
app_id = 90466
time_since_epoch_in_seconds = int(time.time())
payload = {
# issued at time
'iat': time_since_epoch_in_seconds,
# JWT expiration time (10 minute maximum)
'exp': time_since_epoch_in_seconds + (5 * 60),
# GitHub App's identifier
'iss': app_id
}
this_jwt = jwt.encode(payload, open(pem_file, 'r').read().strip().encode(), 'RS256').decode()
gh = Github(jwt=this_jwt)
gh.get_app("ci-results")
# installation = gh.get_installation(installation_id)
# for repo in (installation.get_repos()):
# print (repo)
我收到以下错误:
github.GithubException.BadCredentialsException: 401 {"message": "Bad credentials", "documentation_url": "https://docs.github.com/rest"}
我通过直接在 REST API 中使用来检查创建的 JWT 是否正确。我认为我没有正确使用 pyGitHUb 进行 JWT 身份验证,知道我做错了什么吗?
解决方案
推荐阅读
- javascript - JS Date() 对象的奇怪行为
- flutter - 作为容器的子项的颤振行不起作用
- javascript - 在Angular中导入量角器时如何修复“浏览器”未定义
- c# - 如何在旋转播放器头部时将旋转钳制到每侧 180 度或设置自己的钳制度数?
- vba - VBA 字典对象如果存在不工作
- html - 如何在没有 JS/PHP 的情况下将表单数据从一个 html 文件传递到另一个文件?
- powershell - 电源外壳。循环遍历证书存储并根据指纹删除证书
- c# - 为什么我发布后我的服务器设置没有被读取?
- python - python 可以在 MS Access 中使用而无需链接到数据库吗
- amazon-web-services - Cassandra 在启动后几分钟内因内存不足而崩溃