MCPcopy Create free account
hub / github.com/cztomczak/cefpython / LoadHandler

Class LoadHandler

examples/snippets/cookies.py:20–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19
20class LoadHandler(object):
21 def OnLoadingStateChange(self, browser, is_loading, **_):
22 if is_loading:
23 print("Page loading complete - start visiting cookies")
24 manager = cef.CookieManager.GetGlobalManager()
25 # Must keep a strong reference to the CookieVisitor object
26 # while cookies are being visited.
27 self.cookie_visitor = CookieVisitor()
28 # Visit all cookies
29 result = manager.VisitAllCookies(self.cookie_visitor)
30 if not result:
31 print("Error: could not access cookies")
32 # To visit cookies only for a given url uncomment the
33 # code below.
34 """
35 url = "http://www.html-kit.com/tools/cookietester/"
36 http_only_cookies = False
37 result = manager.VisitUrlCookies(url, http_only_cookies,
38 self.cookie_visitor)
39 if not result:
40 print("Error: could not access cookies")
41 """
42
43
44class CookieVisitor(object):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected