Skip to content

HTTP 429 & 503 errors with arxiv.py even when querying one single paper by ID #195

@MingMing12344321

Description

@MingMing12344321

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

  1. Why am I getting 429 / 503 even for a single, minimal request (one paper ID)?
  2. Is this caused by arXiv IP rate-limiting, or library request behavior?
  3. 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 (...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestions about how to use this package.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions