Got 403 error when connecting to Google Analytics with Python 2.7.x

后端 未结 1 1646
感情败类
感情败类 2021-01-05 06:43

I tried to get data from Google Analytics API with Python client(google-api-python-client). Here\'s the code I used:

from apiclient import discovery
from oau         


        
1条回答
  •  礼貌的吻别
    2021-01-05 07:23

    You are trying to access the Google Analytics API using a service account. A service account by default does not have access to any Google Analytics accounts.

    What you need to do is take the Service account email address from the Google Developer console. Go to the Admin section of the Google Analytics Website. Give this service account access at the ACCOUNT level it must be the ACCOUNT level to the Google Analytics account you wish to access.

    It wont work at the Web property or the view level it must be the Account level.

    0 讨论(0)
提交回复
热议问题