MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / get_all

Method get_all

seleniumbase/undetected/cdp_driver/browser.py:1112–1145  ·  view source on GitHub ↗

Get all cookies. :param requests_cookie_format: when True, returns python http.cookiejar.Cookie objects, compatible with requests library and many others. :type requests_cookie_format: bool

(
        self, requests_cookie_format: bool = False
    )

Source from the content-addressed store, hash-verified

1110 self._browser = browser
1111
1112 async def get_all(
1113 self, requests_cookie_format: bool = False
1114 ) -> List[Union[cdp.network.Cookie, "http.cookiejar.Cookie"]]:
1115 """
1116 Get all cookies.
1117 :param requests_cookie_format: when True,
1118 returns python http.cookiejar.Cookie objects,
1119 compatible with requests library and many others.
1120 :type requests_cookie_format: bool
1121 """
1122 connection = None
1123 for _tab in self._browser.tabs:
1124 if getattr(_tab, "closed", None):
1125 continue
1126 connection = _tab
1127 break
1128 else:
1129 connection = self._browser.connection
1130 cookies = await connection.send(cdp.network.get_cookies())
1131 if requests_cookie_format:
1132 import requests.cookies
1133
1134 return [
1135 requests.cookies.create_cookie(
1136 name=c.name,
1137 value=c.value,
1138 domain=c.domain,
1139 path=c.path,
1140 expires=c.expires,
1141 secure=c.secure,
1142 )
1143 for c in cookies
1144 ]
1145 return cookies
1146
1147 async def set_all(self, cookies: List[cdp.network.CookieParam]):
1148 """

Callers 3

saveMethod · 0.95
get_all_cookiesMethod · 0.80
get_login_cookiesFunction · 0.80

Calls 2

get_cookiesMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected