MCPcopy
hub / github.com/psf/requests / _copy_cookie_jar

Function _copy_cookie_jar

src/requests/cookies.py:479–491  ·  view source on GitHub ↗
(jar: CookieJar | None)

Source from the content-addressed store, hash-verified

477
478
479def _copy_cookie_jar(jar: CookieJar | None) -> CookieJar | None: # type: ignore[reportUnusedFunction] # cross-module usage in models.py
480 if jar is None:
481 return None
482
483 if copy_method := getattr(jar, "copy", None):
484 # We're dealing with an instance of RequestsCookieJar
485 return copy_method()
486 # We're dealing with a generic CookieJar instance
487 new_jar = copy.copy(jar)
488 new_jar.clear()
489 for cookie in jar:
490 new_jar.set_cookie(copy.copy(cookie))
491 return new_jar
492
493
494def create_cookie(name: str, value: str, **kwargs: Any) -> Cookie:

Callers 1

copyMethod · 0.85

Calls 2

set_cookieMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected