Import Error on Google AppEngine : No module named oauth2 - google-app-engine

Im running Google AppEngine. I have oauth2 installed. Im successfully able to import oauth2 in program but when I run my python application using GoogleAppEngine Launcher on localhost, then I get the following error
ImportError: No module named oauth2
Im using Python2.7 which is not the default version of GoogleAppEngine, but I have changed the python path both in my project and in GoogleAppEngine Launcher.

Have you looked at this example? It shows OAuth2 being used in a Google App Engine Python project. This might give you a better sense of how to use OAuth2 and GAE.

Are you trying to authenticate inbound HTTP requests on App Engine using OAuth2?
I just posted a full end to end example here:
google app engine oauth2 provider

Related

How do you serve a website from GCP app engine?

I have set up a Node.js server in Google Cloud Platform App Engine, and have also configured a custom domain, which is correctly configured and has a SSL cert.
However, I can't figure out how to actually serve through the domain.
In the GCP terminal, run this command:
gcloud app deploy
Since the server is already set up and working and the domain is already configured, that command is all that's needed to deploy.

Python program working fine in App Engine Standard Environment. But we get SSL error when we schedule it in App Engine Flexible Environment

We have successfully executed the source data collection python program using App Engine Cron service in App Engine Flexible environment.
Now, We are trying to execute the same python program in App Engine Standard Environment. But, We are getting the Error Can't connect to HTTPS URL because the SSL module is not available.
Anyone came across this Error ? I have given full access to App Engine default service account for the Bucket. Please help to resolve this issue.
Managed to resolve this error.
We need to add the below libraries in the app.yaml
libraries:
- name: ssl
version: latest

Google App Engine Flex Throws 502 After adding Cloud Endpoints

I have an app running on App Engine Flex (Google Go Runtime with a couple extra file in the docker runtime). It was working fine, with no issues.
I then added Google Cloud Endpoints and all of a sudden I was getting 502s for every request, both going directly to the app & going through Cloud Endpoints.
Logging into the instance, it looks like the nginx-proxy itself is throwing errors.
Downloading Endpoints Service Configuration to /etc/nginx/endpoints/service.json
curl: (22) The requested URL returned error: 403 Forbidden
Failed to obtain Endpoints Service Configuration from Service Management API
/sbin/start-stop-daemon: warning: failed to kill 26: No such process
The only addition to the app.yaml is
endpoints_api_service:
name: "redacted.appspot.com"
config_id: "2017-06-01r0"
I'm running the latest version of gcloud. I was getting 403 forbidden when deploying the openapi.yaml file, and then I updated to the latest gcloud which fixed that issue. Not sure if that's related or not.
Has anyone even encountered this before?
From Cloud Console UI, could you double check if your project has "Google Service Management API" enabled?
If already enabled, you can SSH into your Flex vm, and fetch the access token by:
curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token
Then you can use this URL to check its scopes
https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=
Turns out the core issue was that the version of gcloud I first used to upload google cloud endpoints allowed me to use an unsupported parameter (File). After switching to a wildcard, everything worked.

deploy web application to google app engine on travis-ci - travis is asking for a password

I´m trying to deploy a web application to google app engine after successful build(I´m using maven on my project) and travis-ci is asking for my password. How can I input my password or specify somewhere else?
Based on the limited information you are giving us, I am guessing this is happening during the gcloud preview app deploy call.
Typically the docker TLS Verification will need a local public key for a Cert and this requires a passcode response. This situation can be avoided by providing the cert using the travis encrypt-file api and calling gcloud auth activate-service-account during the build. see gloud cli here
Please see the travis yml here for a full example
As always, post questions either here or github for additional walk-through questions.

My Google App Engine appspot URL wont work

I recently created my Google App Engine account, and uploaded my application, and have an instance of said app running.
I can access my app via localhost:8080 but when I try to use myappid.appspot.com I get a 500 Server Error (Of course I replace "myappid" with my apps name). This is what it says:
"Error: Server Error
The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this error message and the query that caused it."
Can anyone help me get the URL working? I need my team to be able to access this app from anywhere. I have no idea what could be wrong with it, I am very new to GAE. After a lot of searching all I find is people saying their appspot URL works, and want other options. But I just want my appspot URL to work first!
Some more info:
This is a Python app, using the GAE Python SDK, I am running Windows 7, and using the GAE Launcher GUI to deploy and run the app.
Thanks in advance!
EDIT: Here is the error in my Log:
: No module named flask Traceback (most recent call last): File "/base/data/home/apps/s~luxtestapp/1.362824400913245138/bootstrap.py", line 19, in from app import create_app File "/base/data/home/apps/s~luxtestapp/1.362824400913245138/app/init.py", line 10, in from flask import Flask
Apparently the app uses Flask instead of Webbapp2. Honestly I'm not too sure about it all, because this is a pre-built app that I downloaded and deployed. I didn't write it.
In the control panel for your app on appspot go to the log section.
Appengine
The see what the latest entry says. Filter to "error".
Also when you create your app (python webapp2 example) turn debugging on:
app = webapp2.WSGIApplication([
('/', MainHandler)],
debug=True)
You'll get a much more informative error screen then instead of '500'.
You need to copy the flask folder to your project folder. In general every package not supported by GAE (see list of supported libraries), must be present in the project folder.
Try setting the environment variables before/after deploy. Go to the local project folder, open bash the paste this commands: ps: Ignore the $ sign
$ set HTTP_PROXY=http://cache.example.com:3128
$ set HTTPS_PROXY=http://cache.example.com:3128
check this link out for help: cloud.google.com/appengine/docs/python/tools/uploadinganapp

Resources