Bishal Dangal
Bishal Dangal

Reputation: 69

Email Settings API - Signature

I am trying to update the signature of all the users of my company and have looked for days and cannot find any proper solution. I have used code snippets of python, Google apps script but none seem to work. Could anybody guide me to do build such application.

Upvotes: 1

Views: 797

Answers (1)

Bishal Dangal
Bishal Dangal

Reputation: 69

I solved it guys. Two sleepless night and bam...

import gdata.apps.emailsettings.client
from gdata.client import BadAuthentication
from gdata.client import RequestError
import urllib2
import requests
import json

# replace these values with yours

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(username='[email protected]', signature='yor_signature')

Upvotes: 2

Related Questions