PyGithub `Repository.compare(base, head)` not working



我正在尝试运行一个与PyGitHub进行比较的GitHub Enterprise Repo。我的代码如下:

repo = github.get_repo("my/repo")
log.debug(f"The Repo: {repo}")
log.debug(f"The URL: {repo.compare_url}")
labels = repo.get_labels()
log.debug(f"Labels: {labels.totalCount}")
compare = repo.compare("BRANCH_A", "TAG_B")
log.debug("Compare:n{compare}")

结果我得到了这个:

2020-10-08:13:38:15,349 DEBUG    [changelog.py:50] The Repo: Repository(full_name="my/repo")
2020-10-08:13:38:15,349 DEBUG    [changelog.py:51] The URL: https://<my.enterprise-github.host>/api/v3/repos/my/repo/compare/{base}...{head}
2020-10-08:13:38:15,446 DEBUG    [changelog.py:54] Labels: 13
2020-10-08:13:38:16,114 DEBUG    [changelog.py:57] Compare:
{compare}

如果我在失眠的情况下运行第3行打印的带有正确参数(https://<my.enterprise-github.host>/api/v3/repos/my/repo/compare/BRANCH_A...TAG_B)的URL,我会得到正确的结果。你有什么提示吗,为什么PyGitHub中的Repository.compare不起作用?

好的。这个问题是我的python noob级别的结果:

我忘记格式化日志字符串,我想在其中显示比较结果:

log.debug(**f**"Compare:n{compare}")

最新更新