Search code examples
google-admin-sdkgoogle-apis-explorer

Google Meet API Error : Python Got an unexpected keyword argument


I am trying to fetch information about a Google Meet meeting. I am able to get all the information related to the app Google Meet when I am not passing the Google Meet Id. But when I am passing the meeting_code, I am getting the following error. https://developers.google.com/admin-sdk/reports/v1/appendix/activity/meet

def main():

    creds = service_account.Credentials.from_service_account_file('srv.json', scopes=SCOPES, subject='admin@*****.com')
    service = build('admin', 'reports_v1', credentials=creds)

    # filters = [{'meeting_code': 'cyo-cdzc-tqp'}]
    results = service.activities().list(userKey='all', applicationName='meet', maxResults=5, meeting_code='cyo-cdzc-tqp').execute()
    print(results)

if __name__ == '__main__':
    main()
TypeError: Got an unexpected keyword argument "meeting_code"

Solution

  • Parameters should be passed are (to list method)

    userKey, applicationName, maxResults, filters
    

    Now you need to filter using meeting code, So pass

    filters='meeting_code==cyocdzctqp'
    

    You should pass meeting code without hyphen

    from googleapiclient.discovery import build
    from google.oauth2 import service_account
    
    import pprint
    pp = pprint.PrettyPrinter(indent=4)
    
    SCOPES = ['https://www.googleapis.com/auth/admin.reports.audit.readonly']
    
    def main():
    
        creds = service_account.Credentials.from_service_account_file('srv.json', scopes=SCOPES, subject='admin@***.**')
        service = build('admin', 'reports_v1', credentials=creds)
    
        results = service.activities().list(userKey='all', applicationName='meet', maxResults=5, prettyPrint=True, filters='meeting_code==cyocdzctqp' ).execute()
        pp.pprint(results)
    
    if __name__ == '__main__':
        main()