我正在尝试更新我公司所有用户的签名,并且已经寻找了几天,但找不到任何合适的解决方案。我使用了 python 的代码片段,Google 应用程序脚本,但似乎都没有工作。任何人都可以指导我构建这样的应用程序。
问问题
738 次
1 回答
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',签名='yor_signature')
于 2016-03-05T17:14:51.883 回答