Search code examples
pythonflasktypeerrorpython-3.3eve

"TypeError: pre_get_callback() missing 1 required positional argument: 'lookup'" when using the get event hook in Eve


I'm trying to use the pre_get event hook in Eve, but when trying to run the examples on the web page I get the following error message:

TypeError: pre_get_callback() missing 1 required positional argument: 'lookup'.

The complete shortdump is available at gist.github

This is my code

def pre_get_callback(resource, request, lookup):
    print ('A GET request on the "%s" endpoint has just been received!' % resource)
    lookup["username"] = {'$exists': True}

I'm using Python 3.3 and the latest version of Eve.


Solution

  • lookup is a 0.4 feature (changelog). You're probably using v0.3 or less. If this is the case a simple

    pip install eve --upgrade
    

    will fix your problem. Eve 0.4 was released yesterday by the way.