Question

I am trying to use cefPython and the OnBeforeResourceLoad method.

I have implemented it as follows:

    def OnBeforeResourceLoad(self, browser, request, redirectURL, streamReader, response, loadFlags):
    #
    if request.GetUrl() == "http://firsturl":
        redirectURL = "http://secondurl"

    return False

However when running the program i get the following:

TypeError: OnBeforeResourceLoad() takes exactly 7 arguments (4 given)

What am I doing wrong here ?

The documentation for this is here:

https://code.google.com/p/cefpython/wiki/RequestHandler

Était-ce utile?

La solution

In CEF 1 that callback takes six arguments. In CEF 3 only three arguments. (with "self" these are seven and four respectively). On the RequestHandler wiki page to which you link to, there are two signatures of that callback, one for CEF 3 and the other for CEF 1.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top