Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.requests.status_codes Namespace Reference

Functions

 _init ()
 

Variables

dict _codes
 
 codes = LookupDict(name="status_codes")
 

Detailed Description

The ``codes`` object defines a mapping from common names for HTTP statuses
to their numerical codes, accessible either as attributes or as dictionary
items.

Example::

    >>> import requests
    >>> requests.codes['temporary_redirect']
    307
    >>> requests.codes.teapot
    418
    >>> requests.codes['\o/']
    200

Some codes have multiple names, and both upper- and lower-case versions of
the names are allowed. For example, ``codes.ok``, ``codes.OK``, and
``codes.okay`` all correspond to the HTTP status code 200.

Function Documentation

◆ _init()

_init ( )
protected

Definition at line 109 of file status_codes.py.

109def _init():
110 for code, titles in _codes.items():
111 for title in titles:
112 setattr(codes, title, code)
113 if not title.startswith(("\\", "/")):
114 setattr(codes, title.upper(), code)
115
116 def doc(code):
117 names = ", ".join(f"``{n}``" for n in _codes[code])
118 return "* %d: %s" % (code, names)
119
120 global __doc__
121 __doc__ = (
122 __doc__ + "\n" + "\n".join(doc(code) for code in sorted(_codes))
123 if __doc__ is not None
124 else None
125 )
126
127
for i

References pip._vendor.requests.status_codes._init(), and i.

Referenced by pip._vendor.requests.status_codes._init().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _codes

dict _codes
protected

Definition at line 23 of file status_codes.py.

◆ codes

codes = LookupDict(name="status_codes")

Definition at line 106 of file status_codes.py.