我想从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应用程序中,我总是得到VerifyErrors!我无法弄清楚原因.每当我包含一个外部JAR时,我总是在尝试启动我的应用程序时获得VerifyErrors(除了一次,当我包含Apache Log4j时).
我通常通过获取库的源代码并将其添加到我的项目来解决这个问题,但我正在尝试放置GData客户端库.
我可以在源代码中获取它,但它的依赖项(mail.jar,activation.jar,servlet-api.jar)我不能,所以我得到验证错误.我想一劳永逸地找到这个问题的根源.我在互联网上看了一下,但他们似乎都在谈论不完整的类文件?我不知道.
我无法使用我的代码获取刷新令牌.我只能获得我的访问令牌,令牌类型等,我已经按照一些教程,比如access_type=offline输入我的登录URL:
echo "<a href='https://accounts.google.com/o/oauth2/auth?"
. "access_type=offline&client_id=123345555.apps.googleusercontent.com& "
. "scope=https://www.googleapis.com/auth/calendar+https://www.googleapis.com/auth/plus.me&response_type=code& "
. "redirect_uri=http://www.sample.com/sample.php&state=/profile'>Google</a>";
Run Code Online (Sandbox Code Playgroud)
以及我获取访问令牌的字段:
$fields=array(
'code'=> urlencode($authcode),
'client_id'=> urlencode($clientid),
'client_secret'=> urlencode($clientsecret),
'redirect_uri'=> urlencode($redirecturi),
'grant_type'=> 'authorization_code',
);
Run Code Online (Sandbox Code Playgroud)
但是我无法获得refresh_token,只有access_token,token_type,id_token和expires_in.
我正在尝试使用任何一个基于libxml的第三方XML解析器,但我不能,因为我认为我有某种类型的libxml2问题
我将其他链接器标志设置为-lxml2
和/ usr/include/libxml2的标题搜索路径
但是当我尝试编译时,我仍然会得到大量未定义的符号.以下错误是尝试编译TouchXML的结果.
Undefined symbols:
"_xmlDocDumpFormatMemory", referenced from:
-[CXMLDocument description] in CXMLDocument.o
"_xmlXPathNewContext", referenced from:
-[CXMLNode nodesForXPath:error:] in CXMLNode.o
-[CXMLNode(CXMLNode_NamespaceExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
"_xmlOutputBufferFlush", referenced from:
-[CXMLNode XMLStringWithOptions:] in CXMLNode.o
"_xmlNodeListGetString", referenced from:
-[CXMLNode stringValue] in CXMLNode.o
"_xmlFree", referenced from:
_xmlFree$non_lazy_ptr in CXMLDocument.o
_xmlFree$non_lazy_ptr in CXMLNode.o
(maybe you meant: _xmlFree$non_lazy_ptr)
"_xmlXPathFreeContext", referenced from:
-[CXMLNode nodesForXPath:error:] in CXMLNode.o
-[CXMLNode(CXMLNode_NamespaceExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
"_xmlNodeDumpOutput", referenced from:
-[CXMLNode XMLStringWithOptions:] in CXMLNode.o
"_xmlAddChild", referenced from:
-[CXMLDocument(CXMLDocument_CreationExtensions) addChild:] in CXMLDocument_CreationExtensions.o
-[CXMLElement(CXMLElement_CreationExtensions) addChild:] in …Run Code Online (Sandbox Code Playgroud) 尝试在Google云端硬盘上验证和访问电子表格时,我突然开始出现以下异常:
未处理的异常:Google.GData.Client.GDataRequestException:执行aut hentication请求返回意外结果:Google.GData.Client.Utilities.QueryClientLoginToken上的Google.GData.Client.Utilities.getAuthException(TokenCollection tokens,Htt pWebResponse响应)中的404 GDataCredentials gc,S service service,String applicationName,Boolean fUseKeepAlive,IWebProxy prox yServer,Uri clientLoginHandler)at Google.GData.Client.GDataGAuthRequest.QueryAuthToken(GDataCredentials gc)at Google.GData.Client.GDataGAuthRequest.EnsureCredentials()at Google.GData位于Google.GData的Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter)的Google.GData.Client.GDataRequest.Execute()的Google.GData.Client.GDataGAuthRequest.EnsureWebRequest()上的.Client.GDataRequest.EnsureWebRequest() Google.GData.Client.Service.Query(FeedQu)上的.Client.GDataGAuthRequest.Execute()at Google.GData.Client.Service.Query(Uri queryUri,DateTime ifModifiedSince,String etag,Int64&contentLength)来自GoogleLogger.GoogleService.getLastXECLogRows(String folderName,String fileName,Int32 rows)的Google.GData.Documents.DocumentsService.Query(DocumentsListQuery feedQuery)的ery feedQuery)
这是代码已经运行了两年没有任何问题.我首先想到我可能已经失去了对我的生产系统的访问权限,但谷歌驱动器在我的网络浏览器中加载得很好.在其他几个系统上尝试过它并且得到了相同的结果.
他们今天在Google API中有所改变吗?这不可能是巧合!
我正在xls使用导入文件gdata.我正在使用转换日期列as.Date来转换日期
根据手册as.Date,日期来源取决于平台,因此我决定相应使用哪个来源
.origin <- ifelse(Sys.info()[['sysname']] == "Windows", "1899-12-30", "1904-01-01")
as.Date(myData$Date, origin=.origin)
Run Code Online (Sandbox Code Playgroud)
但是,我想知道我是否应该考虑正在读取文件的平台或编写文件的平台?
为了它的价值,我目前正在测试没有excel的linux盒子上的代码,并且使用正确的Dates生成 origin="1904-01-01"
引用`?as.Date'
## date given as number of days since 1900-01-01 (a date in 1989)
as.Date(32768, origin = "1900-01-01")
## Excel is said to use 1900-01-01 as day 1 (Windows default) or
## 1904-01-01 as day 0 (Mac default), but this is complicated by Excel
## treating 1900 as a leap year.
## So for …Run Code Online (Sandbox Code Playgroud) 我使用Google相册上传工具上传了大约4万张照片,现在我正在尝试使用Picasa网络相册数据API获取这些照片的列表(因为我没有单独的Google相册API) .
到目前为止,似乎无法获得所有照片的完整列表,因为您一次只能列出1000张照片,然后使用start-index参数进行分页,但是一旦您使用了启动,服务器就会返回错误索引大于11000.如果起始索引为11000,则会发生这种情况:
gdata.photos.service.GooglePhotosException:(500,'内部服务器错误','不推荐的偏移对于流ID查询而言太大.请切换到使用简历令牌.')
(我正在使用Python,但已确认该错误与语言库无关)
我很乐意切换到使用"恢复令牌",如错误指示...除了在我能找到的任何文档中都没有提到它们.
这是经过身份验证的请求,我使用的URL如下所示:
任何人都可以使用简历令牌向我显示示例请求或指向我的文档吗?或者,如果有人知道其他方式来获得大型相册中所有照片的完整列表,那也会很棒.谢谢!
编辑:问题发生在任何语言中,但在Python中,您可以一致地重现它:
startIndex = 1
while 1:
print '(fetching more photos)'
photos = client.GetFeed(ALBUM_URL, limit=1000, start_index=startIndex)
for photo in photos.entry:
print 'startIndex:', startIndex
startIndex += 1
Run Code Online (Sandbox Code Playgroud)
其中ALBUM_URL与我上面列出的URL类似,client是gdata.photos.service.PhotosService的经过身份验证的实例.
我正在开发一个python应用程序,它使用gdata以编程方式为一组人创建和保存日历.除了共享日历中的提醒外,一切正常.
某些上下文:当您创建新项目时,会以您的名义为其创建Google日历.当您邀请协作者时,会与他们共享相同的日历.这样,当你创建任务时,每个人都可以在他们的日历中看到它们.所有这些都已实现并且工作正常.
现在,我希望人们在前一天提醒有关待处理的任务.所以我这样做了:
event = CalendarEventEntry()
#more stuff with the event, such as setting start and end times...
for w in event.when:
w.reminder.append(Reminder(days=1, method="email"))
Run Code Online (Sandbox Code Playgroud)
问题是,提醒仅发送给日历的所有者,而不是与其共享的其他人.
我发现谷歌日历的信息表明它应该在每个用户的设置中手动完成,这是一个我不喜欢的解决方案,因为我的应用程序的重点是以编程方式更新您的日历; 我还读到它可以通过创建组和使用组日历来解决,但这意味着(a)我的现有用户不会受益,(b)可能是巨大的开销,如果没有像样的话我很乐意承担这个特殊问题的解决方案.
截至昨天,我的应用程序能够通过oAuth 2.0与google(youtube)进行身份验证,第一次没问题,但第二次(重新身份验证,相同的应用程序+同一用户),当我为accessToken交换requestToken时,我得到了一个错误:
error : invalid_grant
Run Code Online (Sandbox Code Playgroud)
我正在使用:
grant_type = authorization_code
Run Code Online (Sandbox Code Playgroud)
他们建议的.过去两天前发生的事情是重新验证,网页会说"您之前已使用此应用程序进行过身份验证,是否要再次授予其访问权限?".改变了什么或者我做错了什么?
如何从受密码保护的xlsx工作簿导入工作表R?
我希望能够将Excel工作表转换为csv文件,而无需通过Excel本身.
xls工作簿可以使用xls2csv包中基于perl的函数gdata.我认为问题是Spreadsheet::XLSX不支持它.
有许多用于导入非加密xlsx工作簿的函数和包,但似乎都没有解决这个问题.
目前似乎唯一的选择是通过Excel或弄清楚如何编写可以执行它的perl代码.