Documentation: response object status/reason #1225

Closed
JonathanCooper opened this Issue Mar 1, 2013 · 6 comments

Projects

None yet

3 participants

@JonathanCooper

The response header documentation claims that the headers dict will contain a 'status' entry, containing both the return status and the reason, for example '200 OK'.

In my tests, no such entry exists in the headers dict, although the same data is available with a combination of (assuming a response object called 'r') r.status_code and r.reason.

@Lukasa
Collaborator
Lukasa commented Mar 1, 2013

Wow. That's not been the case for...a while. Want to submit a docs PR to remove it? I'd do it, but I'm preparing to get on a plane.

@Vassius Vassius added a commit to Vassius/requests that referenced this issue Mar 5, 2013
@Vassius Vassius Fix issue #1225 (Documentation: response object status/reason) 90e109c
@Lukasa
Collaborator
Lukasa commented Mar 20, 2013

Fixed by #1234. Thanks!

@Lukasa Lukasa closed this Mar 20, 2013
@mjpieters
Contributor

Note that now the response.reason attribute is entirely undocumented.

@Lukasa
Collaborator
Lukasa commented Feb 5, 2014

This change did not cause that situation to arise. You're right though, it should at least be in the API docs (even though response.reason isn't hugely useful).

@mjpieters
Contributor

(even though response.reason isn't hugely useful)

Someone finds it useful; I was looking into creating a pull request, but the API docs are generated from the source. Digging a little further.

@Lukasa
Collaborator
Lukasa commented Feb 5, 2014

Yeah, I can't imagine how it would be useful to them, but whatever they need. =)

The fix is to put a comment above this line in the format of the other comment blocks in that function, e.g.:

        #: The reason string returned by the server, e.g.
        #: "Not Found" or "OK".
        self.reason = None
@mjpieters mjpieters added a commit to mjpieters/requests that referenced this issue Feb 5, 2014
@mjpieters mjpieters Document the `Response.reason` attribute.
Made `.status_code` and `.reason` consistent with one another, adding some examples. Addresses #1225.
3443c17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment