google-api-python-client

ListRecommendationsRequest constructor error in Python script

ListRecommendationsRequest constructor error in Python script Question: I am trying to prepare a VM Resizing Recommendations Report using a Python 3.7 script. My code is as follows: import datetime import logging from google.cloud import bigquery from google.cloud import recommender from google.cloud.exceptions import NotFound from googleapiclient import discovery def main(event, context): client = recommender.RecommenderClient() recommender_type = …

Total answers: 1

The 'google-api-python-client' distribution was not found and is required by the application with pyinstaller

The 'google-api-python-client' distribution was not found and is required by the application with pyinstaller Question: I am currently trying to build an app with pyinstaller. I have gotten the error The ‘google-api-python-client’ distribution was not found and is required by the application and I’m completely lost why. Running pip show google-api-python-client results with Name: google-api-python-client …

Total answers: 9

Google Photos API + python: Working non-deprecated example

Google Photos API + python: Working non-deprecated example Question: I’ve been finding such a mix of code examples. But nothing with a maintained library (google-auth) + full working example. google-api-python-client and oauth2client are no longer supported (https://github.com/googleapis/google-api-python-client/issues/651). Here’s a working example with deprecated libraries, but I’d like to see some examples that allow full access …

Total answers: 1

Google Drive API How can I find the path of a file?

Google Drive API How can I find the path of a file? Question: I’m trying to find the path of a file when fetching a file list with the Google Drive API. Right now, I’m able to fetch file properties (currently only fetching checksum, id, name, and mimeType): results = globalShares.service.files().list(pageSize=1000,corpora=’user’,fields=’nextPageToken, files(md5Checksum, id, name, mimeType)’).execute() …

Total answers: 1

ValueError: Client secrets must be for a web or installed app

ValueError: Client secrets must be for a web or installed app Question: I am running the quickstart.py example code under Python Quickstart and I am getting the following error: ValueError: Client secrets must be for a web or installed app. I created a credentials.json file with project owner rights. The error occurs in the following …

Total answers: 2

Requested 10 dimensions; only 9 are allowed on Google Analytics Core Reporting API4

Requested 10 dimensions; only 9 are allowed on Google Analytics Core Reporting API4 Question: I have been trying to call Google Analytics core reporting v4 to get basic traffic data, but I could never get default channel grouping/channel grouping from the API. However, the dimension is available according to their metric and dimension explorer. from …

Total answers: 1

Adding a new spreadsheet in an existing workbook raises HttpError "Unknown name requests"

Adding a new spreadsheet in an existing workbook raises HttpError "Unknown name requests" Question: I’m done building the Google Sheets service with the code snippet shown below and I would like to know how to create a new spreadsheet (aka tab) inside an already existing Google Sheet (workbook) with Python. credentials = get_credentials(client_secret_file_path) service = …

Total answers: 3

How do I use google.oauth2 python library?

How do I use google.oauth2 python library? Question: I’m trying to just make a simple rest call to a secure predict endpoint for a google machine learning project but it can’t find the google.oauth2 module. This is my code: import urllib2 from google.oauth2 import service_account # Constants ENDPOINT_URL = ‘ml.googleapis.com/v1/projects/{project}/models/{model}:predict?access_token=’ SCOPES = [‘https://www.googleapis.com/auth/sqlservice.admin’] SERVICE_ACCOUNT_FILE = …

Total answers: 4

Starting a Google Compute instance with Python

Starting a Google Compute instance with Python Question: I am trying to start a Google Compute instance with the Google API Python Client Library. This is so that a cheap instance (running on a single core) can periodically start and stop a more expensive instance (with many cores) periodically, to keep costs down. I have …

Total answers: 4