Home / Function/ _find() — requests Function Reference

_find() — requests Function Reference

Architecture documentation for the _find() function in cookies.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  29dad68b_5239_287f_1d0a_60923ff6da1c["_find()"]
  12ccbc5f_4c31_987c_5272_7babba58a1f2["RequestsCookieJar"]
  29dad68b_5239_287f_1d0a_60923ff6da1c -->|defined in| 12ccbc5f_4c31_987c_5272_7babba58a1f2
  style 29dad68b_5239_287f_1d0a_60923ff6da1c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/requests/cookies.py lines 366–384

    def _find(self, name, domain=None, path=None):
        """Requests uses this method internally to get cookie values.

        If there are conflicting cookies, _find arbitrarily chooses one.
        See _find_no_duplicates if you want an exception thrown if there are
        conflicting cookies.

        :param name: a string containing name of cookie
        :param domain: (optional) string containing domain of cookie
        :param path: (optional) string containing path of cookie
        :return: cookie.value
        """
        for cookie in iter(self):
            if cookie.name == name:
                if domain is None or cookie.domain == domain:
                    if path is None or cookie.path == path:
                        return cookie.value

        raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}")

Domain

Subdomains

Frequently Asked Questions

What does _find() do?
_find() is a function in the requests codebase, defined in src/requests/cookies.py.
Where is _find() defined?
_find() is defined in src/requests/cookies.py at line 366.

Analyze Your Own Codebase

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

Try Supermodel Free