Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update reference to "cookielib" to "cookiejar" in documentation #6214

Merged
merged 1 commit into from
Jul 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions requests/cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
requests.cookies
~~~~~~~~~~~~~~~~

Compatibility code to be able to use `cookielib.CookieJar` with requests.
Compatibility code to be able to use `http.cookiejar.CookieJar` with requests.

requests.utils imports from here, so be careful with imports.
"""
Expand All @@ -23,7 +23,7 @@
class MockRequest:
"""Wraps a `requests.Request` to mimic a `urllib2.Request`.

The code in `cookielib.CookieJar` expects this interface in order to correctly
The code in `http.cookiejar.CookieJar` expects this interface in order to correctly
manage cookie policies, i.e., determine whether a cookie can be set, given the
domains of the request and the cookie.

Expand Down Expand Up @@ -76,7 +76,7 @@ def get_header(self, name, default=None):
return self._r.headers.get(name, self._new_headers.get(name, default))

def add_header(self, key, val):
"""cookielib has no legitimate use for this method; add it back if you find one."""
"""cookiejar has no legitimate use for this method; add it back if you find one."""
raise NotImplementedError(
"Cookie headers should be added with add_unredirected_header()"
)
Expand Down Expand Up @@ -104,11 +104,11 @@ class MockResponse:
"""Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.

...what? Basically, expose the parsed HTTP headers from the server response
the way `cookielib` expects to see them.
the way `http.cookiejar` expects to see them.
"""

def __init__(self, headers):
"""Make a MockResponse for `cookielib` to read.
"""Make a MockResponse for `cookiejar` to read.

:param headers: a httplib.HTTPMessage or analogous carrying the headers
"""
Expand All @@ -124,7 +124,7 @@ def getheaders(self, name):
def extract_cookies_to_jar(jar, request, response):
"""Extract the cookies from the response into a CookieJar.

:param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar)
:param jar: http.cookiejar.CookieJar (not necessarily a RequestsCookieJar)
:param request: our own requests.Request object
:param response: urllib3.HTTPResponse object
"""
Expand Down Expand Up @@ -174,7 +174,7 @@ class CookieConflictError(RuntimeError):


class RequestsCookieJar(cookielib.CookieJar, MutableMapping):
"""Compatibility class; is a cookielib.CookieJar, but exposes a dict
"""Compatibility class; is a http.cookiejar.CookieJar, but exposes a dict
interface.

This is the CookieJar we create by default for requests and sessions that
Expand Down Expand Up @@ -341,7 +341,7 @@ def __setitem__(self, name, value):
self.set(name, value)

def __delitem__(self, name):
"""Deletes a cookie given a name. Wraps ``cookielib.CookieJar``'s
"""Deletes a cookie given a name. Wraps ``http.cookiejar.CookieJar``'s
``remove_cookie_by_name()``.
"""
remove_cookie_by_name(self, name)
Expand Down