Home / Function/ dispatch_hook() — requests Function Reference

dispatch_hook() — requests Function Reference

Architecture documentation for the dispatch_hook() function in hooks.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  924b0ea5_0624_ed50_4e16_6cf84750b162["dispatch_hook()"]
  06c77466_ae83_6ca8_4f12_f6a21fba9313["hooks.py"]
  924b0ea5_0624_ed50_4e16_6cf84750b162 -->|defined in| 06c77466_ae83_6ca8_4f12_f6a21fba9313
  22824d7d_af0c_f593_6513_06ba28a4fc56["send()"]
  22824d7d_af0c_f593_6513_06ba28a4fc56 -->|calls| 924b0ea5_0624_ed50_4e16_6cf84750b162
  style 924b0ea5_0624_ed50_4e16_6cf84750b162 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/requests/hooks.py lines 23–34

def dispatch_hook(key, hooks, hook_data, **kwargs):
    """Dispatches a hook dictionary on a given piece of data."""
    hooks = hooks or {}
    hooks = hooks.get(key)
    if hooks:
        if hasattr(hooks, "__call__"):
            hooks = [hooks]
        for hook in hooks:
            _hook_data = hook(hook_data, **kwargs)
            if _hook_data is not None:
                hook_data = _hook_data
    return hook_data

Domain

Subdomains

Called By

Frequently Asked Questions

What does dispatch_hook() do?
dispatch_hook() is a function in the requests codebase, defined in src/requests/hooks.py.
Where is dispatch_hook() defined?
dispatch_hook() is defined in src/requests/hooks.py at line 23.
What calls dispatch_hook()?
dispatch_hook() is called by 1 function(s): send.

Analyze Your Own Codebase

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

Try Supermodel Free