Skip to content

Instantly share code, notes, and snippets.

@kokes
Last active December 28, 2017 22:55
Show Gist options
  • Save kokes/1ae02532493caba74a17241fff6aece0 to your computer and use it in GitHub Desktop.
Save kokes/1ae02532493caba74a17241fff6aece0 to your computer and use it in GitHub Desktop.
{
"type": "service_account",
"project_id": "proj",
"private_key_id": "xxx",
"private_key": "xxx",
"client_email": "foobarbaz.iam.gserviceaccount.com",
"client_id": "123123123123",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/foobarbaz"
}
# service account bez consentu
# https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-py
from apiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
SCOPES = ['https://www.googleapis.com/auth/analytics.readonly']
KEY_FILE_LOCATION = '../cred/credentials.json'
VIEW_ID = 'xxxx'
credentials = ServiceAccountCredentials.from_json_keyfile_name(
KEY_FILE_LOCATION, SCOPES)
analytics = build('analytics', 'v4', credentials=credentials)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment