0

I'm new to integrations with the API SDK GOOGLE, and I need to consume the Workspace activity reports regarding the use of google Chat, I configured the following code, but I believe it is wrong, I didn't find a documentation that helps me to validate the form correct way to make calls to the reports api

from oauth2client.service_account import ServiceAccountCredentials
from httplib2 import Http
from apiclient.discovery import build
import googleapiclient.discovery


#escopos necessarios
scopes = [
'https://www.googleapis.com/auth/admin.reports.usage.readonly',
'https://www.googleapis.com/auth/drive.metadata.readonly',
'https://www.googleapis.com/auth/admin.reports.usage.readonly',
'https://www.googleapis.com/auth/admin.reports.audit.readonly',
'https://www.googleapis.com/auth/analytics',
'https://www.googleapis.com/auth/analytics.readonly',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/apps.alerts',
'https://www.googleapis.com/auth/apps.order.readonly',
'https://www.googleapis.com/auth/apps.order',
'https://www.googleapis.com/auth/admin.directory.user.readonly',
'https://www.googleapis.com/auth/admin.directory.domain',
'https://www.googleapis.com/auth/admin.directory.domain.readonly',
'https://www.googleapis.com/auth/calendar.readonly' ,
'https://www.googleapis.com/auth/drive.readonly',
'https://www.googleapis.com/auth/admin.directory.user',
'https://www.googleapis.com/auth/cloud-platform'      
 
 ]
#dominio que sera pesquisado 
TARGET='dominio.test.com'

#credenciais de acesso 
credentials = ServiceAccountCredentials.from_json_keyfile_name('./chave.json', scopes)
delegated_credentials = credentials.create_delegated('admin@email.com')


http_auth = credentials.authorize(Http())

service = googleapiclient.discovery.build('admin', 'directory_v1', 
credentials=delegated_credentials)

response = service.activities().list(users='all',applicationName='chat')

print(response)

I've already used this code for other queries and it's working for accessing the directory and listing users but when I tried to adapt it to query chat activities it doesn't work I have the following error

    response = service.activities().list(customerId='all',applicationName='chat')
    AttributeError: 'Resource' object has no attribute 'activities'
  • 1
    Does this answer your question? [How do I resolve the AttributeError: 'Resource' object has no attribute in Google API?](https://stackoverflow.com/questions/64923395/how-do-i-resolve-the-attributeerror-resource-object-has-no-attribute-in-googl) – ewokx Apr 29 '22 at 07:55
  • Unfortunately not, what I'm trying to do is list the Chat activity report, I've already managed to list the users, but I still haven't managed to list the chat activity reports. – Rodrigo Martins Apr 29 '22 at 14:46

0 Answers0