one_of=DimensionValue.OneOf(
AttributeError: type object ‚DimensionValue‘ has kein Attribut 'OneOf'" Irgendwelche Ideen? Es wird ein Shell-Spiel, ich würde ein Problem wie dieses beheben, dann treten an anderer Stelle etwas anderes auf, eine Funktion, eine Klasse oder ... Variablennamenfehler ausgegeben.
Code: Select all
import sys
sys.path.append('./')
from globals import *
from datetime import datetime, timedelta
SCOPES = ['https://www.googleapis.com/auth/analytics.readonly']
KEY_FILE_LOCATION = GLOBAL_KEY_FILE_LOCATION
MEASUREMENT_ID = GLOBAL_MEASUREMENT_ID
from google.oauth2 import service_account
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import (
DateRange,
Dimension,
Metric,
RunReportRequest,
CohortSpec,
Cohort,
DimensionValue,
CohortsRange,
CohortReportSettings,
)
def sample_run_report(start_date_day, end_date):
credentials = service_account.Credentials.from_service_account_file(KEY_FILE_LOCATION, scopes=SCOPES)
client = BetaAnalyticsDataClient(credentials=credentials)
start_date = datetime.strptime(start_date_day, '%Y-%m-%d')
end_date = datetime.strptime(end_date, '%Y-%m-%d')
while start_date