PyGithub / PyGithub/PyGithub

RateLimitExceededException not raised when rate limit exceeds via making many PRs

オープン
#2,422 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
7.8k
フォーク
1.9k
平均マージ
17分
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、ブランチ、ファイル、プルリクエストを繰り返し作成する例を使って、secondary-rate-limit のレスポンスを再現します。GitHub API クライアントがこの 403 レスポンスをどのように処理するかを追跡し、RateLimitExceededException の処理と比較します。ドキュメントに記載された secondary-rate-limit のレスポンスが GithubException ではなく RateLimitExceededException を発生させ、その動作をテストでカバーできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
github, python
領域
api, backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。