Enable mail forwarding using a Google Apps Service Account

后端 未结 2 1835
北荒
北荒 2020-12-11 10:47

On April 20, 2015, several Google Apps APIs are being discontinued, including the Provisioning API(gdata).
In my Python scripts, I am using a Service Account and OAuth 2

2条回答
  •  暖寄归人
    2020-12-11 11:20

    This should be the proper way to use the credentials object directly:

    import gdata.gauth
    
    credentials = SignedJwtAssertionCredentials(serviceEmail,
                                                key, 
                                                sub=adminEmail,
                                                scope=scopes)
    client = gdata.apps.emailsettings.client.EmailSettingsClient(domain='mydomain.co')
    client.auth_token = gdata.gauth.OAuth2TokenFromCredentials(credentials)
    client.UpdateForwarding(username=username, enable=True, 
    forward_to=forwardTo, action='ARCHIVE')
    

提交回复
热议问题