GA多通道漏斗报告Python错误

GA多通道漏斗报告Python错误,python,google-analytics-api,Python,Google Analytics Api,我已经成功地使用G网站上提供的python示例,使用reports().batchGet() 现在我必须对多通道漏斗(mcf)进行同样的操作 我在StackO或其他任何地方看到的一切都是调用service.data().mcf().get()。但是我得到了一个错误:AttributeError:“Resource”对象没有属性“service” 我认为这是我构建请求的方式,但使用googleapiclient的方式与我之前的方式相同,我不知道我错了什么 下面是我初始化此调用的示例: from a

我已经成功地使用G网站上提供的python示例,使用
reports().batchGet()

现在我必须对多通道漏斗(mcf)进行同样的操作

我在StackO或其他任何地方看到的一切都是调用
service.data().mcf().get()
。但是我得到了一个错误:AttributeError:“Resource”对象没有属性“service”

我认为这是我构建请求的方式,但使用google
apiclient
的方式与我之前的方式相同,我不知道我错了什么

下面是我初始化此调用的示例:

from apiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials

SCOPES = ['https://www.googleapis.com/auth/analytics.readonly']
KEY_FILE_LOCATION = 'client_secrets.json'

def initialize_analytics_reporting():
    """
    Initializes an Analytics Reporting API V4 service object.
    :return: An authorized Analytics Reporting API V4 service object.
    """
    credentials = ServiceAccountCredentials.from_json_keyfile_name(
        KEY_FILE_LOCATION, SCOPES)

    # Build the service object.
    analytics = build('analyticsreporting', 'v4', credentials=credentials)

    return analytics

def get_report(analytics, next_token):
    """
    Queries the Analytics Reporting API V4.
    Args:
      analytics: An authorized Analytics Reporting API V4 service object.
    Returns:
      The Analytics Reporting API V4 response.
    """
    print(analytics.__dict__)
    if next_token == 0:
        return analytics.data.mcf().get(..)
    [...]
不适用于未来我或其他:

analytics = build('analytics', 'v3', credentials=credentials)
工作