我正在尝试更新公司所有用户的签名,并且已经找了好几天,找不到任何合适的解决方案。我使用了python的代码片段,谷歌应用程序脚本,但似乎没有工作。任何人都可以指导我做这样的应用程序。
答案 0 :(得分:2)
我解决了它们。两个不眠之夜和bam ...
import gdata.apps.emailsettings.client
from gdata.client import BadAuthentication
from gdata.client import RequestError
import urllib2
import requests
import json
#将这些值替换为您的
CONSUMER_KEY = 'XXXXXX'
CONSUMER_SECRET = 'XXXXXXXXXXXXXXXXXXX'
company_name = 'XXXXXXXXXXXXX'
admin_username = 'admin'
# request a 2-legged OAuth token
requestor_id = admin_username + '@' + CONSUMER_KEY
two_legged_oauth_token = gdata.gauth.TwoLeggedOAuthHmacToken(
CONSUMER_KEY, CONSUMER_SECRET, requestor_id)
#calling the emailsettings api
email_settings_client = gdata.apps.emailsettings.client.EmailSettingsClient(domain=CONSUMER_KEY)
email_settings_client.auth_token = two_legged_oauth_token email_settings_client.UpdateSignature(用户名=' xxx.xxx@xxxx.com' ;, signature =' yor_signature')