psf / requests

A simple, yet elegant, HTTP library.

Home Page:https://requests.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

raise_for_status documentation is out of sync

dennyb87 opened this issue · comments

Not a bug per se, more like a discrepancy between documentation and actual behaviour.

Expected Result

The documentation says response.raise_for_status() should return the response for chaining in trivial use cases.

Screenshot from 2024-04-14 11-19-57

Actual Result

The code in the latest version of package doesn't actually allow it, see raise_for_status in models.py

Reproduction Steps

...
    response.raise_for_status().json()
AttributeError: 'NoneType' object has no attribute 'json'

Hi @dennyb87, thanks for raising this. I responded in a comment here in your PR. If you can provide examples from the official docs hosted on readthedocs, we'd be happy to fix this, but from what I can see currently, this never existed in the Requests documentation. What you provided above is an unmaintained fork we do not have control over.

Nice catch @nateprewitt . I didn't have time to click through but the screenshot seemed convincing

Ouch 🤦 that's embarrassing 😅 my bad! apologies for the annoyance 👋

No worries, thanks for checking in!