소스 검색

Handle actual 429

master
JustAnotherArchivist 1 년 전
부모
커밋
c2f6f5054c
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. +3
    -1
      ia-cdx-search

+ 3
- 1
ia-cdx-search 파일 보기

@@ -26,7 +26,9 @@ def fetch(url, tries, connection):
status = r.status
print(f'{status} {url}', file = sys.stderr)
if status == 302 and r.getheader('Location') in ('https://web.archive.org/429.html', '/429.html'):
# The CDX API is stupid and doesn't return 429s directly...
# The CDX API is (was?) stupid and doesn't return 429s directly...
status = 429
if status == 429:
print('Exceeded rate limit, waiting...', file = sys.stderr)
time.sleep(30)
raise RuntimeError(f'Rate-limited on {url}')


불러오는 중...
취소
저장