Question

I am trying to set up my first ever API connection with Yelp, I am using GAE on Python. To do so, I used the following example: https://github.com/Yelp/yelp-api/blob/master/v2/python/search.py At first I simply try to run the code by the following definition in my app.yaml

handlers:
- url: /search
script: search.py

However when I load the page it gives the following error: No module named oauth2. I have read through many of the topics that seem to cover this error but none really helped in resolving it. I also tried importing oauth2client which was mentioned in some answers however this was also not accepted.

The only thing that was accepted by the system was

from google.appengine.api import oauth

Therefore I tried to work with this module, but immediately ran into another problem. I filled out my credentials (consumer_key, consumer_secret, token, token_secret) by defining them as default value in the parser definition. To replicate the examples request on https://github.com/Yelp/yelp-api/tree/master/v2/python I also added a default value for 'term' (bars) and 'location' (sf).

When loading the page with this it however gives me the error 'module' object has no attribute 'Consumer', so this also doesn't seem to be the solution. As said this is my first time setting up such a system, so probably I am missing something obvious. Thanks a lot for your thoughts.

Was it helpful?

Solution

You cannot replace modules just like that, the script you are referring to works with the oauth2 library, which is different from GAE OAuth API (that's why you were getting the 'module' object has no attribute 'Consumer').

As explained in the README of the yelp-api, first you need to install the oauth2 module. Note that you need to copy the installed module (or source) to your GAE project in order to upload it to GAE when deploying.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top