Jack tileman
Jack tileman

Reputation: 871

from oauth2client.contrib.appengine import AppAssertionCredentials ImportError: No module named appengine

We are trying to import AppAssertionCredentials from oauth2client. We are using python27 standard google app engine.

Our appengine_config.py is as follows

from google.appengine.ext import vendor

# Add any libraries installed in the "lib" folder.
vendor.add('lib')

The import statement in one of our modules is this.

 # from oauth2client.appengine import AppAssertionCredentials
 import httplib2
 from oauth2client.client import GoogleCredentials
 from oauth2client.contrib.appengine import AppAssertionCredentials

We checked the "lib" folder in our application. It has oauth2client in it. It also has contrib which has the appengine.py file. We did the following to install our requirements.

google-endpoints==4.8.0
google-endpoints-api-management==1.11.0
apiclient
firebase_admin
sendgrid==5.2.0
google.auth
jinja2
pytz
stripe
twilio
httplib2
oauth2client==3.0.0
GoogleAppEngineCloudStorageClient

For some reason when we execute endpointscfg.py it is throwing this error. The endpointscfg.py is from here. from oauth2client.contrib.appengine import AppAssertionCredentials ImportError: No module named appengine

Updated

Our app.yaml is as follows -

runtime: python27
api_version: 1
threadsafe: true
instance_class: F2
automatic_scaling:
  max_instances: 100
  min_pending_latency: 30ms  # default value
  max_pending_latency: automatic

libraries:
- name: webapp2
  version: latest  
- name: jinja2
  version: latest
- name: pycrypto
  version: 2.6
- name: PIL
  version: 1.1.7
- name: ssl
  version: 2.7.11


inbound_services:
- channel_presence

handlers:

- url: /stylesheets
  static_dir: stylesheets

- url: /images
  static_dir: images

- url: /javascripts
  static_dir: javascripts

- url: /static
  static_dir: static
  application_readable: true 


- url: /sakthihemaadmin
  script: main.app
  secure: always

- url: /sakthihemaadmindisplay
  script: main.app  

- url: /signup
  script: main.app
  secure: always

- url: /login
  script: main.app
  secure: always

- url: /forgot
  script: main.app
  secure: always

- url: /initprogram
  script: main.app
  secure: always

- url: /debugprogram
  script: main.app
  secure: always


# Endpoints handler: this must be /_ah/spi for Endpoints, NOT /_ah/api!
- url: /_ah/api/.*
  # script: cloudendpointapi.APPLICATION
  script: main.api

# Required for deferred 
- url: /_ah/queue/deferred
  script: google.appengine.ext.deferred.deferred.application
  login: admin


- url: .*
  script: main.app 

We are not creating OpenAPI document but rather creating the client libraries as listed here.

 endpointscfg.py get_discovery_doc

Upvotes: 1

Views: 184

Answers (1)

Jack tileman
Jack tileman

Reputation: 871

Instead of using endpointscfg.py get_discovery_doc please use $ lib/endpoints/endpointscfg.py .

I guess there was another version of endpointscfg.py in my environment that was causing the issue.

This helped me resolve the issue.

Upvotes: 1

Related Questions