-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making it easier to use the google-auth library in App Engine #169
Comments
Here's one of the errors I observed in my tests:
|
I'm also getting the following import error when testing on local dev app server:
The library is definitely installed in the system, and also in the vendored |
@hiranya911 thanks for filing. Unfortunately, yes, you do have to do all of those steps to get requests and SSL working on standard. I'd be happy to accept a PR to add those steps to the user guide in the documentation. As for your error when running tests with the local dev app server, how are you running the tests? |
I was simply trying to launch the dev app server from command-line:
|
@hiranya911 did you have the vendor setup in |
Yes, I have the following in from google.appengine.ext import vendor
vendor.add('lib') I managed to resolve the module loading issue by using the following instead: # appengine_config.py
import os
import google
from google.appengine.ext import vendor
lib_directory = os.path.dirname(__file__) + '/lib'
# Change where to find the google package (point to the lib/ directory)
google.__path__ = [os.path.join(lib_directory, 'google')] + google.__path__
# Add any libraries install in the "lib" folder.
vendor.add(lib_directory) It would be nice if I could avoid having to do this though. |
Weird - you shouldn't need to do that |
Hi, I just run into the
I noticed that there is no
The file actually exist in repository: https://github.com/GoogleCloudPlatform/google-auth-library-python/blob/master/google/__init__.py The thing is that the import works, when I add the |
@stibi how do you install dependencies for AWS Lambda? (I am unfamiliar with the product) |
@jonparrott it's a ZIP with everything bundled together:
https://gist.github.com/stibi/b8bcba1a149f8ef3afb8280363facedd |
Oh, that won't work at all. Simply dropping packages into the root of your project doesn't magically make all of Python's import machinery work. Notably, namespace packages and package resources won't work. You'll need to actually stuff them in a sub directory and call |
Ok, I thought that the problem will be most probably in loading the dependencies…this is how AWS Lambda packaging works :( Thanks for the hints, I'll try to find a workaround. |
I had the same @jonparrott Regarding the google.__path__ = [os.path.join(lib_directory, 'google')] + google.__path__ whilst the following alternative didn't solve the problem google.__path__ = google.__path__ + [os.path.join(lib_directory, 'google')] |
Shouldn't the Otherwise the lib doesn't work on dev_appserver.. |
I've just run into the same case, it turned out there was a conflict So if anyone encounter the same problem: |
you can try |
in my case i Added ### sudo python3 -m pip install google-api-python-client |
I had to jump through a number of hoops to get the requests transport working in the App Engine environment:
ssl
library to the app.yaml:Only by doing all the above, that I could get the HTTPS request to Google OAuth2 token servers working. Is this to be expected? Is there anything that can be done to make using this library in App Engine easier?
The text was updated successfully, but these errors were encountered: