-
Notifications
You must be signed in to change notification settings - Fork 152
Description
I’m running the official minimal example of arxiv.py to fetch one single paper by arXiv ID, but I keep getting HTTP 503 (Service Unavailable) followed by repeated HTTP 429 (Too Many Requests) errors. The retries eventually give up.
Questions
- Why am I getting 429 / 503 even for a single, minimal request (one paper ID)?
- Is this caused by arXiv IP rate-limiting, or library request behavior?
- How to properly configure arxiv.Client to avoid this?
Environment
Python: 3.12
arxiv.py: 1.4.8
OS: Windows 11
import logging
import arxiv
logging.basicConfig(level=logging.DEBUG)
def get_arxiv_paper(paper_id: str):
client = arxiv.Client()
search = arxiv.Search(id_list=[paper_id])
paper = next(client.results(search))
return paper
if name == "main":
TARGET_PAPER_ID = "1605.08386v1"
try:
paper = get_arxiv_paper(TARGET_PAPER_ID)
print(paper.title)
except Exception as e:
print(f"Failed: {e}")
Full error log
INFO:arxiv:Requesting page (first: True, try: 0): https://export.arxiv.org/api/query?search_query=&id_list=1605.08386v1&sortBy=relevance&sortOrder=descending&start=0&max_results=100
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): export.arxiv.org:443
DEBUG:urllib3.connectionpool:https://export.arxiv.org:443 "GET /api/query?search_query=&id_list=1605.08386v1&sortBy=relevance&sortOrder=descending&start=0&max_results=100 HTTP/1.1" 503 126
DEBUG:arxiv:Got error (try 0): Page request resulted in HTTP 503 (...)
INFO:arxiv:Sleeping: 2.999493 seconds
INFO:arxiv:Requesting page (first: True, try: 1): https://export.arxiv.org/api/query?search_query=&id_list=1605.08386v1&sortBy=relevance&sortOrder=descending&start=0&max_results=100
DEBUG:urllib3.connectionpool:Resetting dropped connection: export.arxiv.org
DEBUG:urllib3.connectionpool:https://export.arxiv.org:443 "GET /api/query?search_query=&id_list=1605.08386v1&sortBy=relevance&sortOrder=descending&start=0&max_results=100 HTTP/1.1" 429 14
DEBUG:arxiv:Got error (try 1): Page request resulted in HTTP 429 (...)
INFO:arxiv:Sleeping: 3.000000 seconds
INFO:arxiv:Requesting page (first: True, try: 2): https://export.arxiv.org/api/query?search_query=&id_list=1605.08386v1&sortBy=relevance&sortOrder=descending&start=0&max_results=100
DEBUG:urllib3.connectionpool:https://export.arxiv.org:443 "GET /api/query?search_query=&id_list=1605.08386v1&sortBy=relevance&sortOrder=descending&start=0&max_results=100 HTTP/1.1" 429 14
DEBUG:arxiv:Got error (try 2): Page request resulted in HTTP 429 (...)
INFO:arxiv:Sleeping: 2.998984 seconds
INFO:arxiv:Requesting page (first: True, try: 3): https://export.arxiv.org/api/query?search_query=&id_list=1605.08386v1&sortBy=relevance&sortOrder=descending&start=0&max_results=100
DEBUG:urllib3.connectionpool:https://export.arxiv.org:443 "GET /api/query?search_query=&id_list=1605.08386v1&sortBy=relevance&sortOrder=descending&start=0&max_results=100 HTTP/1.1" 429 14
DEBUG:arxiv:Giving up (try 3): Page request resulted in HTTP 429 (...)
Failed: Page request resulted in HTTP 429 (...)