Home / File/ status_codes.py — requests Source File

status_codes.py — requests Source File

Architecture documentation for status_codes.py, a python file in the requests codebase. 2 imports, 3 dependents.

File python CoreAPI SessionLifecycle 2 imports 3 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  49a0c53c_80e1_9458_74b1_35d844ac4420["status_codes.py"]
  989bc203_d602_fe82_ab02_7d12fb621eee["structures.py"]
  49a0c53c_80e1_9458_74b1_35d844ac4420 --> 989bc203_d602_fe82_ab02_7d12fb621eee
  5a377969_ad3d_e489_2ea4_d2a86802e4b3["LookupDict"]
  49a0c53c_80e1_9458_74b1_35d844ac4420 --> 5a377969_ad3d_e489_2ea4_d2a86802e4b3
  961d4893_d7e8_96e8_b607_9aeb34411448["__init__.py"]
  961d4893_d7e8_96e8_b607_9aeb34411448 --> 49a0c53c_80e1_9458_74b1_35d844ac4420
  461bc6e0_32e7_8eab_ec87_7226e7be0d13["models.py"]
  461bc6e0_32e7_8eab_ec87_7226e7be0d13 --> 49a0c53c_80e1_9458_74b1_35d844ac4420
  ea1101aa_233b_1206_7b38_a38f0fe92a52["sessions.py"]
  ea1101aa_233b_1206_7b38_a38f0fe92a52 --> 49a0c53c_80e1_9458_74b1_35d844ac4420
  style 49a0c53c_80e1_9458_74b1_35d844ac4420 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

r"""
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.
"""

from .structures import LookupDict

_codes = {
    # Informational.
    100: ("continue",),
    101: ("switching_protocols",),
    102: ("processing", "early-hints"),
    103: ("checkpoint",),
    122: ("uri_too_long", "request_uri_too_long"),
    200: ("ok", "okay", "all_ok", "all_okay", "all_good", "\\o/", "✓"),
    201: ("created",),
    202: ("accepted",),
    203: ("non_authoritative_info", "non_authoritative_information"),
    204: ("no_content",),
    205: ("reset_content", "reset"),
    206: ("partial_content", "partial"),
    207: ("multi_status", "multiple_status", "multi_stati", "multiple_stati"),
    208: ("already_reported",),
    226: ("im_used",),
    # Redirection.
    300: ("multiple_choices",),
    301: ("moved_permanently", "moved", "\\o-"),
    302: ("found",),
    303: ("see_other", "other"),
    304: ("not_modified",),
    305: ("use_proxy",),
    306: ("switch_proxy",),
    307: ("temporary_redirect", "temporary_moved", "temporary"),
    308: (
        "permanent_redirect",
        "resume_incomplete",
        "resume",
    ),  # "resume" and "resume_incomplete" to be removed in 3.0
    # Client Error.
    400: ("bad_request", "bad"),
    401: ("unauthorized",),
    402: ("payment_required", "payment"),
    403: ("forbidden",),
    404: ("not_found", "-o-"),
    405: ("method_not_allowed", "not_allowed"),
// ... (69 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does status_codes.py do?
status_codes.py is a source file in the requests codebase, written in python. It belongs to the CoreAPI domain, SessionLifecycle subdomain.
What functions are defined in status_codes.py?
status_codes.py defines 1 function(s): _init.
What does status_codes.py depend on?
status_codes.py imports 2 module(s): LookupDict, structures.py.
What files import status_codes.py?
status_codes.py is imported by 3 file(s): __init__.py, models.py, sessions.py.
Where is status_codes.py in the architecture?
status_codes.py is located at src/requests/status_codes.py (domain: CoreAPI, subdomain: SessionLifecycle, directory: src/requests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free