diff options
| author | Zane Bitter <zbitter@redhat.com> | 2017-11-21 12:39:22 -0500 |
|---|---|---|
| committer | Zane Bitter <zbitter@redhat.com> | 2017-11-21 16:11:34 -0500 |
| commit | 19919b44c4af95f125704c902acecdf83d70a3e4 (patch) | |
| tree | 69fe3f186e47ce28c138fc7d1d21072568311c6c /docs/api.rst | |
| parent | acd2645444d280ac0c5d2d227fdd222cb1ac609c (diff) | |
| download | python-requests-19919b44c4af95f125704c902acecdf83d70a3e4.tar.gz | |
Add documentation for available status codes
There was no way to determine what actual names were available outside
of looking at the source code. They were not listed in the documentation
or accessible through the interactive help.
In addition, doing `pydoc requests.status_codes` displayed some pretty
unhelpful information - the utf-8 encoding string was included in the
module name, there was no description, and internal variables used for
initialisation leaked into the module scope:
DATA
code = 511
codes = <lookup 'status_codes'>
title = 'network_authentication'
titles = ('network_authentication_required', 'network_auth', ...
This change prevents the internal variables from leaking, adds a
docstring (which has the side-effect of correcting the module name), and
appends information on the allowed status code names to the docstring
when the module is initialised.
The improved module documentation is then used in the API documentation
to provide another easy reference to the complete list of status codes.
Diffstat (limited to 'docs/api.rst')
| -rw-r--r-- | docs/api.rst | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/docs/api.rst b/docs/api.rst index ed61bb38..c3e00e54 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -109,17 +109,7 @@ Status Code Lookup .. autoclass:: requests.codes -:: - - >>> requests.codes['temporary_redirect'] - 307 - - >>> requests.codes.teapot - 418 - - >>> requests.codes['\o/'] - 200 - +.. automodule:: requests.status_codes Migrating to 1.x |
