PyGithub / PyGithub/PyGithub

RateLimitExceededException not raised when rate limit exceeds via making many PRs

未關閉
#2,422 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Python
星號
7.8k
分支
1.9k
平均合併
17 分鐘
30 天內合併 PR
2

描述

When the rate limit is exceeded using by making too many PRs, the RateLimitExceededException is not raised, instead it is a GithubException. I would expect that it would be the rate limit exception, given it's a 403 and gives the rate limit exceeded exception:

403 {"documentation_url": "https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#secondary-rate-limits", "message": "You have exceeded a secondary rate limit. Please wait a few minutes before you try again."}

Example code:

def create_branch(repo, branch_name):
    sb = repo.get_branch(repo.default_branch)
    repo.create_git_ref(ref='refs/heads/' + branch_name, sha=sb.commit.sha)

def exceed():
    for i in range(100):
        repo = g.get_repo("mhoeger/test")
        branch = f"mhoeger/test-branch-{time.time()}"
        create_branch(repo, branch)
        repo.create_file("test.txt", "TEST!", "hi", branch)
        repo.create_pull("testing", "test", repo.default_branch, branch)

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先,使用會重複建立分支、檔案和 pull request 的範例重現 secondary-rate-limit 回應。追蹤 GitHub API 用戶端如何處理此 403 回應,並將其與 RateLimitExceededException 的處理進行比較。完成標準是:文件中所述的 secondary-rate-limit 回應引發 RateLimitExceededException,而不是 GithubException,且測試涵蓋此行為。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
github, python
領域
api, backend
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。