我希望使用radioButton2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
radioButton2.setChecked(true);
radioButton1.setChecked(false);
radioButton3.setChecked(false);
radioButton4.setChecked(false);
radioButton5.setChecked(false);
radioButton6.setChecked(false);
}
});
}
获取特定用户发送的电子邮件的列表(主题,日期时间,发件人)。
我找到了G Suite Email Audit API Developer's Guide,但遗憾的是没有任何python示例。
google-api-python-client
是否可以实现这一点?
答案 0 :(得分:1)
G Suite Email Audit API是仍然使用Google Data API protocol的旧版API之一。 google-api-python-client不支持此协议,但您必须使用gdata-python-client。这个库很旧,Google不再更新它了:
以下是如何使用它的示例:
from __future__ import print_function
import argparse
import gdata.apps.audit.service
from oauth2client import file, client, tools
SCOPES = ['https://apps-apis.google.com/a/feeds/compliance/audit/',]
# be sure to update with the correct user
ID = 'user@domain.com'
store = file.Storage('email-audit{}.json'.format(ID))
creds = store.get()
# client_id.json is the client_id file generated from the developer console project
if not creds or creds.invalid:
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
flags.auth_host_port = [8010, 8020]
flow = client.flow_from_clientsecrets('client_id.json', SCOPES)
creds = tools.run_flow(flow, store, flags)
access_token, expires_in = creds.get_access_token()
gd_client = gdata.apps.audit.service.AuditService(domain=ID.split('@')[1])
gd_client.additional_headers[u'Authorization'] = u'Bearer {0}'.format(access_token)
monitors = gd_client.getEmailMonitors(ID.split('@')[0])
print(monitors)
如果您想要Google提供的原始样本,可以找到它here。它比我的复杂得多,我怀疑它是否有效,因为它没有执行OAuth2身份验证;用它作为参考。