I want to create a Google Cloud Function in Python to
- connect to the Google Search Console API
- extract data
- pipe it into BigQuery
I can find various code samples to authenticate and connect via OAuth, secret keys etc however these all appear to apply to Python scripts running locally, not in the cloud. (I need this to run in the cloud, unattended).
The Google documentation says that, within a Cloud Function, authentication can happen automatically using "Application Default Credentials (ADC) to automatically find your service account credentials".
This code sample for example connects and authenticates to Cloud Storage:
def implicit():
from google.cloud import storage
# If you don't specify credentials when constructing the client, the
# client library will look for credentials in the environment.
storage_client = storage.Client()
# Make an authenticated API request
buckets = list(storage_client.list_buckets())
print(buckets)
I cannot however find any documentation on how to create a Google Search Console client that will authenticate via the ADC mechanism.
Help please!