Reputation:
I've tried literally everything I could possibly find on the internet. The current error I get is "No module named 'google_auth_oauthlib'" but when I look for the module, it says it exists. I've also tried running the quickstart.py thing Google asks you to run and I get the error "ModuleNotFoundError: No module named 'googleapiclient'" Again, I've looked for it and it does exist. The code i'm trying to run is
import os
from Google import Create_Service
CLIENT_SECRET_FILE = ('client_secret.json')
API_SERVICE_NAME = 'sheets'
API_VERSION = 'v4'
SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
service = Create_Service(CLIENT_SECRET_FILE, API_SERVICE_NAME, API_VERSION, SCOPES)
Upvotes: 1
Views: 1118
Reputation: 11
Faced same issue. What I did:
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib oauth2client
Then:
from googleapiclient.discovery import build
from google.oauth2 import service_account
file_id = "file_id"
creds = ServiceAccountCredentials.from_json_keyfile_name("json-file.json", scope)
drive_service = build("drive", "v3", credentials=creds)
request = drive_service.files().get_media(fileId=file_id)
That did the trick.
Upvotes: 1