- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在编写一个小型 python 脚本,它将检索我的 Google 联系人列表(使用 Google Contacts API ),并随机建议我联系一个人(自动与 friend 保持联系的好方法!)
这只是一个独立的脚本,我计划将其安排在 cron 作业上。问题是 Google 似乎需要 OAuth2 风格的身份验证,其中用户(我)必须批准访问,然后应用程序会收到一个授权 token ,我可以用它来查询用户(我)的联系人。
由于我只访问自己的数据,有没有办法对自己进行“预授权”?理想情况下,我希望能够检索一些授权 token ,然后运行脚本并将该 token 作为环境变量传递
AUTH_TOKEN=12345 python my_script.py
这样就不需要用户输入/交互来授权一次。
最佳答案
您描述的实现调用完整的“三足”OAuth 握手,这需要明确的用户同意。如果您不需要用户同意,您可以通过 Google service account 使用“两条腿”OAuth ,它与应用程序绑定(bind),而不是用户。一旦你granted permission要访问您的联系人,您可以使用 oauth2client
到您的服务帐户ServiceAccountCredentials
class无需用户同意即可直接访问GData。
这是来自 Google service account documentation 的两条腿身份验证示例:
import json
from httplib2 import Http
from oauth2client.service_account import ServiceAccountCredentials
from apiclient.discovery import build
scopes = ['https://www.googleapis.com/auth/sqlservice.admin']
credentials = ServiceAccountCredentials.from_json_keyfile_name(
'service-account.json', scopes)
sqladmin = build('sqladmin', 'v1beta3', credentials=credentials)
response = sqladmin.instances().list(project='examinable-example-123').execute()
print response
关于python - 授权 python 脚本在没有 OAuth2 用户流程的情况下访问 GData API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38669200/
在 Gdata 中使用电子表格 api 获取电子表格列表, Oauth1 方式 spreadSheetService = gdata.spreadsheet.service.SpreadsheetsS
当我读这两本书时,它们似乎针对同一件事并且由同一作者撰写。那么这两者有什么不同呢? 谢谢 最佳答案 service.py 模块用于该库的 v1 实现,通过引入 client.py 实现了该库的显着改进
Zend GData 文档中的 $worksheetId 应该是什么? http://framework.zend.com/manual/en/zend.gdata.spreadsheets.html
我已经有了 access_token 和 refresh_token,但我想不出一种方法来创建授权的 gdata 客户端,而无需在 gdata 中完成整个 token 生成工作流程。 最佳答案 所以我
我需要更新 iPhone 应用程序上的 Google 文档电子表格中的一些单元格。 我已经下载了 GData 源代码和示例项目(不是 iphone 专用的),但我似乎无法让它工作。有人知道有什么好的(
有相似之处(在身份验证和其他一些操作中,例如都可以获取文档列表),但有什么区别?为什么我们需要两者? 我正在学习 gdata api,我意识到我可以通过这种方式使用 OAuth 访问 token 登录
我会在表格中滑动所有单元格,但我没有解决。我的代码是: SpreadsheetService service = new SpreadsheetService("MyApp"); try{
我正在使用 Google gdata 库。我将其安装在我的本地 Maven 存储库中,因为无法使用 pom 从 Maven Central 获取它。 我想将其移至我的 WEB-INF/lib 目录,这
我已经使用 MAC 的 GData 电子表格代码编写了相应的 iPhone 版本(相同的代码),但抛出了异常:[GDataEntryBase worksheetsFeedURL]:无法识别的选择器发送
我正在使用以下代码将 .mov 文件上传到 youtube。上传成功,但视频没有任何音频。如果我做错了什么,请告诉我...... - (void)uploadVideoFile { NSStrin
如何获取youtube feed标签并将其转换为android中的字符串/整数。 我想使用标签,以及属性:totalUploadViewCount? https://developers.google
我只是在使用此网址在YouTube上用“害怕”一词找到收视率最高的视频。 http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?q=sc
我正在使用GData Api从ios应用程序在youtube上上传视频。 它成功上传了视频,但是音频丢失了。 我正在使用.mp4格式的视频。 有人有线索吗? 谢谢 -(BOOL) setupWrite
我正在尝试将 GData 框架包含在我的项目中几个小时,但我完全迷失了。我正在尝试按照 gdata-objectivec-client 页面 ( https://code.google.com/p/g
有什么方法可以避免使用gdata api时ClientLogin有时需要的验证码吗? 最佳答案 您可以尝试一下。希望这是一回事。 http://www.gmailhelp.com/recent-art
阅读 documentation 后和 Google's developer guide ,我没有找到添加第二个地址线的方法。 例如,如果我想将此地址存储为 Google 联系人: 先生。王牌人物 露
正在使用 gdata 在 appengine 上使用 python 来更新我的驱动器上的电子表格文件。一切都工作正常,直到最近,代码开始遇到错误。 import webapp2 import
我想使用它的 API 从 google 服务器获取 xml 数据。所以,我无法对回复进行任何更改。那么,我如何让这个电话对我有用: $.ajax({ type: 'POST',
我以前问过这个问题,但没有答案。于是又问。 我只是不知道要使用哪个 gdata 框架类,以便我可以搜索 youtube 视频。我通过调试代码使用了一些类,但我认为框架太深了,可能需要很多时间才能解决这
Youtube API文档指出,可以按照以下链接在视频获取过程中搜索多个关键字。 https://developers.google.com/youtube/2.0/reference#Searchi
我是一名优秀的程序员,十分优秀!