Document which exceptions request() might raise

Open
#6,653 6 comments 0 reactions 0 assignees View on GitHub

@yadneshx17 is already working on this.

Since Nov 18, 2025.

  • #7356 by @DoriAlagem — closed without merging

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
documentation

Research direction

Start with the main interface documentation for request() and the linked exceptions reference, then inspect the request() entry point to identify exceptions associated with each documented method. Done means the API documentation clearly states which exceptions each main-interface method may raise, with behavior consistent with the existing Response.json() documentation.

Written by the indexing model from the issue text.

Description

Ask to document which exceptions request() might raise

I notice that the .json function documents that it might raise a JSONDecodeError. This is very helpful for writing comprehensive error handling code around requests. I'm asking for that to be done for the main interface as well.

While a list of exceptions is provided in the documentation, it is not clear which exceptions will be returned by which methods. For example I don't think JSONDecodeError can be raised by .get. I tried to read the requests code to get a sense of which might be thrown from it, but it is a little challenging to follow as a first time reader.

Dominant language
Python
Stars
54.7k
Forks
10.8k
Avg merge
18m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from psf/requests

All issues in psf/requests

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.