I am trying to get Google's OAuth to work via the API client for Python.
https://developers.google.com/api-client-library/python/start/installation
I have used easy_setup to install it, and I have the apiclient packages in the same directory as my Python client. However, when I run my client, I get
from apiclient.discovery import build
from apiclient.errors import HttpError
ImportError: No module named errors
It looks like it can't find the errors.py class in the apiclient directory, but it is clearly there.
I have the packages included in my client:
from apiclient.discovery import build
from apiclient.http import MediaFileUpload
import httplib2
import mimetypes
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.file import Storage as FileStorage
import oauth2client.tools
Is there a way around this?
Thanks.
A client_secrets.json file is a JSON formatted file containing the client ID, client secret, and other OAuth 2.0 parameters.
InstalledAppFlow class is used for installed applications. This flow is useful for local development or applications that are installed on a desktop operating system. See OAuth 2.0 for Installed Applications. from google_auth_oauthlib.flow import InstalledAppFlow flow = InstalledAppFlow.
This sounds like a path problem.
From the command line in your OS, start the python
binary:
user@/usr/bin python
You should see something like this:
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Next import sys, then print sys.path:
import sys
sys.path
sys.path will show all the locations python is currently aware of to look for libraries. Confirm that the api client exists in one of those paths, and that the permissions on that path are correct.
Sharing a screenshot of the output from the above steps will help further diagnose your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With