我想从Google获取访问令牌. Google API说要获取访问令牌,请将代码和其他参数发送到令牌生成页面,响应将是一个JSON对象,如:
{
"access_token" : "ya29.AHES6ZTtm7SuokEB-RGtbBty9IIlNiP9-eNMMQKtXdMP3sfjL1Fc",
"token_type" : "Bearer",
"expires_in" : 3600,
"refresh_token" : "1/HKSmLFXzqP0leUihZp2xUt3-5wkU7Gmu2Os_eBnzw74"
}
Run Code Online (Sandbox Code Playgroud)
但是,我没有收到刷新令牌.我的回答是:
{
"access_token" : "ya29.sddsdsdsdsds_h9v_nF0IR7XcwDK8XFB2EbvtxmgvB-4oZ8oU",
"token_type" : "Bearer",
"expires_in" : 3600
}
Run Code Online (Sandbox Code Playgroud) 在Android应用程序中使用Google数据API的最不痛苦和最有效的方法是什么?
经过几次快速搜索后,似乎Google Code上有一个android-gdata项目似乎是单个作者的工作.我没有找到它的任何文档,甚至不知道它是否已准备好生产.
较旧的选项,com.google.wireless.gdata包似乎已从 SDK中删除.它仍然可以在GIT存储库中找到.
在我用这两种方法投入太多时间之前,我想知道哪种方法最好,哪种方式最不痛苦.
在Gmail中,有一个名为"任务"的小功能.它可以让我输入待办事项列表.我想知道是否有任何官方/非官方的Google API可以通过Java语言访问/更新列表?
我想使用Google Data API,但我使用的是Python 3.我没有看到他们提到有关Python 3的任何内容.是否可以为Python 3安装gdata?
要将Google电子表格的单个工作表导出为CSV,需要传递整数工作表索引(GID).
https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=%s&gid=%d&exportFormat=csv
但是,那些信息在哪里?使用gdata.spreadsheets.client,我可以找到工作表的一些字符串id,如"oc6,ocv,odf".
client = gdata.spreadsheets.client.SpreadsheetsClient()
feed = client.GetWorksheets(spreadsheet, auth_token=auth_token)
Run Code Online (Sandbox Code Playgroud)
它返回原子XML下面.(一部分)
<entry gd:etag=""URJFCB1NQSt7ImBoXhU."">
<id>https://spreadsheets.google.com/feeds/worksheets/0AvhN_YU3r5e9dGpTWGx3UVU3MTczaXJuNEFKQjMwN2c/ocw</id>
<updated>2012-06-21T08:19:46.587Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-21T08:19:46.587Z</app:edited>
<category scheme="http://schemas.google.com/spreadsheets/2006" term="http://schemas.google.com/spreadsheets/2006#worksheet"/>
<title>AchievementType</title>
<content type="application/atom+xml;type=feed" src="https://spreadsheets.google.com/feeds/list/0AvhN_YU3r5e9dGpTWGx3UVU3MTczaXJuNEFKQjMwN2c/ocw/private/full"/>
<link rel="http://schemas.google.com/spreadsheets/2006#cellsfeed" type="application/atom+xml" href="https://spreadsheets.google.com/feeds/cells/0AvhN_YU3r5e9dGpTWGx3UVU3MTczaXJuNEFKQjMwN2c/ocw/private/full"/>
<link rel="http://schemas.google.com/visualization/2008#visualizationApi" type="application/atom+xml" href="https://spreadsheets.google.com/tq?key=0AvhN_YU3r5e9dGpTWGx3UVU3MTczaXJuNEFKQjMwN2c&sheet=ocw"/>
<link rel="self" type="application/atom+xml" href="https://spreadsheets.google.com/feeds/worksheets/0AvhN_YU3r5e9dGpTWGx3UVU3MTczaXJuNEFKQjMwN2c/private/full/ocw"/>
<link rel="edit" type="application/atom+xml" href="https://spreadsheets.google.com/feeds/worksheets/0AvhN_YU3r5e9dGpTWGx3UVU3MTczaXJuNEFKQjMwN2c/private/full/ocw"/>
<gs:rowCount>280</gs:rowCount>
<gs:colCount>28</gs:colCount>
</entry>
Run Code Online (Sandbox Code Playgroud)
我也尝试使用sheet参数但是因"Invalid Sheet"错误而失败.
https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=%s&sheet=XXX&exportFormat=csv
我想应该有一些神奇的功能,但找不到它.我怎样才能将它们转换为整数id?或者我可以导出带有字符串ID的工作表吗?
编辑:我刚刚用python制作了转换表.很脏但工作:-(
GID_TABLE = {
'od6': 0,
'od7': 1,
'od4': 2,
'od5': 3,
'oda': 4,
'odb': 5,
'od8': 6,
'od9': 7,
'ocy': 8,
'ocz': 9,
'ocw': 10,
'ocx': 11,
'od2': 12,
'od3': 13,
'od0': …Run Code Online (Sandbox Code Playgroud) gdata-api google-sheets gdata-python-client google-spreadsheet-api
简短的问题是这是否可能,如果可能,如何?
我有一个.NET应用程序,它目前使用服务帐户使用Google Drive API访问Google Apps域中的信息.这可以正常使用google-api-dotnet-client库和代码沿着这里的示例所示的相同行- 这是目前我正在做的一个非常好的基本示例.
我现在要做的是扩展它以及使用 "新"google-api-dotnet-client库提供的那些API,它使用旧的"GData"库,通过较旧的google-gdata库提供,特别是Spreadsheets API(也许还有更多).
这就是出现困难的地方.前一个库完全符合我的要求,正如上面第一段中的第二个链接所证明的那样 - 以及我自己做它的事实.但是 ......虽然第二个库已经更新,除了OAuth 1.0和其他旧的auth技术之外还支持OAuth 2.0,但据我所知,从广泛的谷歌搜索和跟踪错误中可以看出,"代表我所有用户的服务帐户"我需要的操作.
我的问题是我是否遗漏了一些东西(可能很难找到或没有记载的东西),这些东西可以让我做我想做的事.如果不这样做,有什么方法可以强迫这种行为并使这两个库并排运行?
理想情况下,我希望某种方式让Google.GData.Spreadsheets.SpreadsheetsService实例能够利用Google.Apis.Authentication.Auth2Authenticator<AssertionFlowClient>我已经在使用的实例...不知何故.这种巫术有可能吗?我错过了那个显而易见的东西吗?
如果不这样做,我很高兴再次完成整个OAuth2"断言流客户端"的舞蹈,如果我不得不以某种方式让旧库可以处理.
救命?
我考虑过 - 暂时拒绝 - 选择从头开始编写我自己的库来实现这一目标.这有两个原因:
我一直希望避免但可能不得不依赖于此处的答案的另一种方法是使用2脚OAuth 1.0来实现这一点.我宁愿不这样做,因为应用程序的某些部分依赖于一种旧的auth方法,而其他部分则使用这种新方式对我来说感觉不对.而且还有更多的问题......
我已经考虑过继承GDataRequestFactory和GDataRequest的可能性,所以我可以创建自己的请求工厂,然后获取Google.Apis.Authentication.Auth2Authenticator<AssertionFlowClient>(好的,Google.Apis.Authentication.IAuthenticator无论如何的实例)的实例,它可以在调用之前调试请求.但是...... GDataRequest的构造函数是内部的,这已经阻止了我.
它真的看起来不是这个意思.
我正在尝试从YouTube获取的RTSP流中读取视频帧.这是我的测试视频的链接:
RTSP://v8.cache5.c.youtube.com/CiILENy73wIaGQkJlrXMiAG8BxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp
如果我正在从本地文件中读取帧 - 一切都很好,但是当从流中读取它们时,除了大量的工件之外什么都没有.我已经google了一下,发现UDP数据包可能存在问题,切换到TCP可能有所帮助,但我真的找不到可以改变它的地方.
这是读取框架的功能:
bool nextFrame(AVFormatContext *pFormatCtx, AVCodecContext *pCodecCtx, int videoStream, AVFrame *pFrame) { AVPacket packet;
int frameFinished = 0;
while( !frameFinished && av_read_frame(pFormatCtx, &packet) >= 0 ) {
// Is this a packet from the video stream?
if( packet.stream_index == videoStream ) {
// Decode video frame
avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
}
// Free the packet that was allocated by av_read_frame
av_free_packet(&packet);
}
return frameFinished!=0;
}
Run Code Online (Sandbox Code Playgroud)
我在日志中也收到了很多错误消息:
[h263 @ 0x7804c00] warning: first frame is no keyframe
[h263 …Run Code Online (Sandbox Code Playgroud) 使用Google Contacts API,您可以使用JSON获取联系信息,但有没有办法使用JSON更新它?我在尝试中没有取得任何成功,并且在我尝试时继续得到"prolog中不允许的内容"错误(似乎表明他们期望在PUT请求中使用XML).
在GET请求中,我从以下网址获取:http://www.google.com/m8/feeds/contacts/user@gmail.com/full? alt = json
当我想使用XML I PUT将联系人更新为以下类型的URL(根据正在更新的联系人而有所不同):http: //www.google.com/m8/feeds/contacts/user@gmail.com /碱/ 0
我已经尝试将alt = json添加到PUT请求中,但这只是在黑暗中拍摄,因为我没有找到任何实际文档来确认使用JSON进行更新甚至是可能的.我正在使用firefox插件在JS中进行这种交互,所以这就是为什么我的偏好是使用JSON(我一直在使用E4X直到这一点并发现它非常笨拙).
任何帮助将不胜感激!
由于Google将ClientLogin API列为已弃用,建议的替代方案是什么?在我的情况下,我需要一个服务器来验证并使用我拥有的凭据发布内容.像OAuth这样的替代品在这种情况下不起作用
我正在尝试编写一个将其数据库存储在Google电子表格中的iPhone应用程序.我按照此处的DrEdit示例使用Drive API将纯文本文件读/写到Google云端硬盘.我正在尝试修改示例应用以使用电子表格.我能够上传csv文件并要求Google进行转换.但是,我真正想要的是直接使用mimeType:"application/vnd.google-apps.spreadsheet".我对此非常陌生,如果有人能指出我的例子,那将是非常有帮助的.对于初学者,我想实现以下类似的东西
- (void)uploadSpreadSheetWithThreeCells {
GTLUploadParameters *uploadParameters = nil;
NSString *data = @"cell1,cell2,cell3";
NSData *spreadSheetContent = nil;
/*
How to initialize spreadSheetContent with data?
*/
[GTLUploadParameters uploadParametersWithData:spreadSheetContent
MIMEType:@"application/vnd.google-apps.spreadsheet"];
GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:self.driveFile
uploadParameters:uploadParameters];
[self.driveService executeQuery:query completionHandler:nil];
}
Run Code Online (Sandbox Code Playgroud)
此外,Google Drive API是否正确使用?最终,我希望能够更新电子表格的选定单元格,而不是上传整个文档.我发现了一些其他选项,如gdata api和spreadsheet api,但似乎Drive API是最新的,它应该包含其他两个的功能?
提前致谢!
gdata-api ×10
.net ×1
access-token ×1
android ×1
api ×1
c# ×1
ffmpeg ×1
gdata ×1
gmail ×1
google-api ×1
ios ×1
iphone ×1
java ×1
javascript ×1
json ×1
oauth-2.0 ×1
python ×1
python-3.x ×1
rtsp ×1
youtube ×1