1

I want to use a library which it use oauth2. Unfortunatelly, Google app engine cannot find oauth2 as a library.

When I browse my project I have the following error

    import oauth2 as oauth
    ImportError: No module named oauth2

I cannot use the oauth of google app engine, because I have to change the whole library.

Any advice how I can make oauth2 works on GAE?

The library use this version of oauth2 enter link description here

  • https://developers.google.com/appengine/docs/python/oauth/overview says ``from google.appengine.api import oauth`` – gongzhitaao Apr 10 '13 at 21:28
  • if I use this library, then my custom library won't work as it use oauth2 code. –  Apr 10 '13 at 21:29
  • where do you put the ``oauth2`` library? Might this of help: http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder? – gongzhitaao Apr 10 '13 at 21:30
  • I use easy install and it is on C:\Python27\Lib\site-packages\oauth2-1.5.170-py2.7.egg\ –  Apr 10 '13 at 21:36
  • 1
    If you want to deploy your app on appengine, you have to include your libraries in your project folder 'cause you cannot change google app server environment, i.e. you will have no ``oauth2`` on appengine server. – gongzhitaao Apr 10 '13 at 21:39
  • oauth2 library is not a single file to include it in my folder. It is a whole folder with a lot of files inside. –  Apr 10 '13 at 21:44
  • If you want it to work on the server also, then copy it... That's what I've figured out so far for one of my projects:) – gongzhitaao Apr 10 '13 at 21:47
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/27986/discussion-between-tasos-and-gongzhitaao) –  Apr 10 '13 at 21:50
  • Any lib not included by google must be included in your project for deployment, be it a single file or collection of directories. You will need modify sys.path or use site to manipulate the python path so your application can find these modules at runtime. – Tim Hoffman Apr 11 '13 at 00:07

1 Answers1

0

Ok you have to install the package first. It will install to your default python library. There are 3 ways to do this:

First way (MAC):

    sudo easy_install oauth2

Second Way:

    pip install oauth2

Third way (If you want to have more control over install location):

  1. Download the zip file from here https://github.com/simplegeo/python-oauth2/archive/master.zip
  2. Then unzip the file and navigate to the folder where it downloaded to.
  3. Run

    python3 setup.py 
    

    or

    python setup.py
    

Depending on which package you'd like (python3 or 2)

swsmith
  • 238
  • 2
  • 6