用于从谷歌域中获取用户的python脚本

时间:2013-07-20 21:16:07

标签: python gdata

这里的python脚本应该从谷歌域中获取用户...出于某种原因,似乎得到了授权标题错误。不知道我错过了什么尝试搜索,但没有成功。

下面是整个python脚本。

import gdata.apps.service
import gdata.apps.groups.service
from array import *
import simplejson as json

consumer_key = '*******'
consumer_secret = 'd#######Q' #check advanced / OAuth in you control panel
sig_method = gdata.auth.OAuthSignatureMethod.HMAC_SHA1

service = gdata.apps.service.AppsService(domain=consumer_key)
service.SetOAuthInputParameters(sig_method, consumer_key, consumer_secret=consumer_secret, two_legged_oauth=True)
words=""
myDict = {}


res = service.RetrieveAllUsers()
for entry in res.entry:
    #words.append(entry.login.user_name)
    #myDict[entry.login.user_name] = entry.login.user_name
 words+=str(entry.login.user_name)+","


print words               

我在retrieveallusers()时收到错误。

0 个答案:

没有答案