PyGithub`Repository.comparebase,head`不起作用

问题描述

我正在尝试与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}

如果我使用失眠的正确参数(https://<my.enterprise-github.host>/api/v3/repos/my/repo/compare/BRANCH_A...TAG_B)运行第3行中打印出的URL,我将获得正确的结果。您有什么提示,为什么PyGitHub中的Repository.compare无法正常工作?

解决方法

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

我忘了格式化Log-String,我想在其中显示Compare-Result:

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