跳至內容
superbot.gg

Python requests 錯誤

429 Client Error: Too Many Requests for url

當網站回應 429 時,raise_for_status() 會發出這個錯誤。後面的網址就是你要求的頁面。

你向網站發出請求的頻率太高。
網站要你放慢速度。

這代表什麼

429 表示客戶端在一段時間內傳送了太多請求。伺服器可能會加上 Retry-After 標頭,告知需要等待多久。

限制通常依 IP 位址計算;請求已登入時,也會依使用者或金鑰計算。範圍可能涵蓋整個網站,或僅限單一路徑。

修正

  1. 從回應中讀取 Retry-After,並在下一次請求前等待相同的時間。
  2. 在請求之間加入延遲,每次重複出現 429 後等待更久。
  3. 重複使用已擷取的內容:快取頁面,只請求有變動的部分。
  4. 如果一直被限制,代表該網站希望你使用它的 API 或付費方案。

使用 superbot

superbot 的讀取工具遇到速率限制時會明確說明,而不是丟出錯誤。它會回傳 page_rate_limited 和這則訊息,網站有提供時也會一併傳回網站的 Retry-After 值:

page returned 429: the site is rate limiting readers. Read the same facts from another source, or read this page again later.

遇到單純的速率限制,用真正的瀏覽器也沒用,所以 superbot 不會改用瀏覽器重試。下一步是換個來源,或稍後再讀同一個頁面。

提問

讀取 https://httpbin.org/status/429,告訴我為什麼打不開。

回覆
It opened fine; httpbin answered with HTTP 429, an empty body by design.

…

httpbin's /status/<code> endpoint exists to return exactly that status code and nothing else, so 429 here is not a rate limit you hit and not a failure of your connection.
2026-10-18 的真實回答,已刪節。測試網址刻意傳回 429,因此回覆會讀取狀態碼並說明其意義。

這需要帳號。
沒有帳號的代理會透過 /auth.md 幫你登入。
你回報一組寄到信箱的驗證碼。

來源:MDN:429 Too Many Requests。查閱於 2026-10-18。