我想在带有pys60的Symbian设备上使用Google Data API,但我找不到任何文档.有没有办法在Symbian上安装Google Data API Python客户端库?
将Google Docs Java API与Google Apps帐户一起使用,是否可以冒充用户并下载文件?
当我运行下面的程序时,它显然登录到域并模拟用户,因为它检索其中一个文件的详细信息并打印出文件标题.但是,当它尝试下载文件时,会抛出ServiceForbiddenException.
如果Java API无法实现,是否有人知道我的程序是否可以使用Protocol API编写HTTP请求来下载文件?
public class AuthExample {
private static DocsService docService = new DocsService("Auth Example");
public static void main(String[] args)
throws Exception
{
String adminUser = args[0];
String adminPassword = args[1];
String authToken = args[2];
String impersonatedUser = args[3];
loginToDomain(adminUser, adminPassword, authToken);
URL url = new URL( "https://docs.google.com/feeds/" + impersonatedUser + "/private/full" );
DocumentListFeed feed = docService.getFeed(url, DocumentListFeed.class);
DocumentListEntry entry = feed.getEntries().get(0);
String title = entry.getTitle().getPlainText();
System.out.println( title );
String type = entry.getType();
if …Run Code Online (Sandbox Code Playgroud) 由于谷歌已弃用谷歌数据列表API,因此我们可以将"Google Drive API"用于Google云端硬盘,但谷歌网站呢?我目前正在使用Google.Gdata.client.dll引用与Google协作平台合作.
我正在编写一个应用程序来访问Google相册上的用户图片.
似乎Google照片没有"官方"API,但可以通过Picasa网络相册API访问这些图片.
NodeJS/Javascript没有正式的Google Picasa网络相册API参考/文档.
如何从我的Node应用程序访问此API?
我可以使用我从网上找到的以下代码使用我的应用程序登录到谷歌。它返回一个授权代码作为响应。谷歌帮助说这个验证码应该用于发送未来的 POST/GET 请求。
我需要从http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=DOCUMENT_ID&fmcmd=4下载 Excel 格式的电子表格, 当我登录到谷歌时,我通常可以从浏览器中下载。
如何使用 C# 中的授权代码发送对上述文件的请求?我在 SO 中看到了一个使用 Google Data API 的线程。我不想利用它。
下面是登录的代码示例。它工作正常。
string str = "/accounts/ClientLogin HTTP/1.0 Content-type: application/x-www-form-urlencoded accountType=GOOGLE&Email=myname@gmail.com&Passwd=password&service=cl&source=Gulp-CalGulp-1.05";
string uri = "https://www.google.com/accounts/ClientLogin";
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri);
request.KeepAlive = false;
request.ProtocolVersion = HttpVersion.Version10;
request.Method = "POST";
byte[] postBytes = Encoding.ASCII.GetBytes(str);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postBytes.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(postBytes, 0, postBytes.Length);
requestStream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StringBuilder sb = new StringBuilder();
string webresponse = new StreamReader(response.GetResponseStream()).ReadToEnd();
int AuthIndex = …Run Code Online (Sandbox Code Playgroud) 我正在使用JavaScript Google Data API,并且在让AuthSub脚本正常运行时遇到问题.这是我目前的脚本:
google.load('gdata', '1');
function getCookie(c_name){
if(document.cookie.length>0){
c_start=document.cookie.indexOf(c_name + "=");
if(c_start!=-1){
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if(c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start, c_end));
}
}
return "";
}
function main(){
var scope = 'http://www.google.com/calendar/feeds/';
if(!google.accounts.user.checkLogin(scope)){
google.accounts.user.login();
} else {
/*
* Retrieve all calendars
*/
// Create the calendar service object
var calendarService = new google.gdata.calendar.CalendarService('GoogleInc-jsguide-1.0');
// The default "allcalendars" feed is used to retrieve a list of all
// calendars (primary, secondary and subscribed) of the logged-in user
var feedUri …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用我从django-social-auth获取的OAuth令牌来访问用户日历.
所以在我设置的django-social-auth配置中:
GOOGLE_CONSUMER_KEY = 'anonymous'
GOOGLE_CONSUMER_SECRET = 'anonymous'
GOOGLE_OAUTH_EXTRA_SCOPE = ['https://www.google.com/calendar/feeds/']
Run Code Online (Sandbox Code Playgroud)
当用户从谷歌回来时,我在数据库中得到一个如下所示的条目:
{u'access_token': u'oauth_token_secret=vvvv&oauth_token=xxxx'}
Run Code Online (Sandbox Code Playgroud)
但现在,当我尝试做这样的事情时:
import gdata.calendar.client
client = gdata.calendar.client.CalendarClient()
client.auth_token = gdata.gauth.OAuthHmacToken('anonymous', 'anonymous', 'xxxx', 'vvvv', gdata.gauth.ACCESS_TOKEN)
client.GetOwnCalendarsFeed()
Run Code Online (Sandbox Code Playgroud)
我总是得到:
gdata.client.Unauthorized: Unauthorized - Server responded with: 401
<HEAD>
<TITLE>Token invalid - Invalid AuthSub token.</TITLE>
</HEAD>
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么?
关于 google API 的信息太多了。所以我在所有的研究中迷失了方向。
我的目标:
我的谷歌文档帐户下有一个电子表格。我想每天运行一个 cron 作业,从特定单元格中提取单元格值(每天都会增加到下一行),然后对其他服务进行一些其他 API 调用,然后将结果写入同一行的另一列中。
大多数 oAuth 2.0 内容都需要询问用户,这在 cron 作业中是不可能发生的。我发现了一些关于服务帐户的信息,但那是一种全新类型的帐户,而且它似乎有自己的凭据。我已经创建了 4 种类型的安全凭证。
问题)如何在 PHP 中验证我的 google 帐户而不向用户询问任何内容?
我想在身份验证后与 cURL 一起使用的 URL 是这样的
https://spreadsheets.google.com/tq?tqx=out:json&tq=<QUERY>&key=<MY KEY>
Run Code Online (Sandbox Code Playgroud)
感谢任何能提供帮助的人!
我已经构建了Google数据API Objective-C客户端库,并将其链接并与我的应用程序(包括GTMOAuth2)一起使用,并可以将数据拉回来.我需要使用Provisioning API(仍然只支持XML),因此我在自己的应用程序中构建了我需要的附加功能.我想我终于想出了所有这些是如何工作的,我非常接近阅读自定义元素,但我遗漏了一些东西.
我子类GDataServiceGoogle,GDataEntryBase以及GDataFeedBase和我得到正确的数据备份.我从一个简单直接的元素类型开始:quota.在Users Feed中,quota元素如下所示:
<apps:quota limit="2048"/>
Run Code Online (Sandbox Code Playgroud)
所以,我添加了以下值构造:
@interface GDataQuotaProperty : GDataValueConstruct <GDataExtension>
+ (NSString *)extensionElementURI;
+ (NSString *)extensionElementPrefix;
+ (NSString *)extensionElementLocalName;
@end
@implementation GDataQuotaProperty
+ (NSString *)extensionElementURI { return kGDataNamespaceGApps; }
+ (NSString *)extensionElementPrefix { return kGDataNamespaceGAppsPrefix; }
+ (NSString *)extensionElementLocalName { return @"quota"; }
@end
Run Code Online (Sandbox Code Playgroud)
我已经将以下方法添加到我的GDataEntryBase子类中:
- (GDataQuotaProperty *)quota;
- (void)setQuota:(GDataQuotaProperty *)val;
Run Code Online (Sandbox Code Playgroud)
实施如下:
- (GDataQuotaProperty *)quota {
return [self objectForExtensionClass:[GDataQuotaProperty class]];
} …Run Code Online (Sandbox Code Playgroud) objective-c google-data-api xcode4.3 google-provisioning-api
我们在OAuth2中使用Google Contacts API:
credential = new GoogleCredential.Builder().setTransport(new NetHttpTransport())
.setJsonFactory(new JacksonFactory())
.setClientSecrets(OAuth2ClientId(), OAuth2ClientSecret())
.addRefreshListener(new CredentialRefreshListener() {...});
myService = new ContactsService("My-App");
myService.setOAuth2Credentials(credential);
Run Code Online (Sandbox Code Playgroud)
并且我们经常收到GData库无法处理的"401 Unauthorized"响应.AuthenticationException在WWW-Authenticate标头丢失时抛出NPE .
Caused by: java.lang.NullPointerException: No authentication header information
at com.google.gdata.util.AuthenticationException.initFromAuthHeader(AuthenticationException.java:96) ~[gdata-core-1.0-1.47.1.jar:na]
at com.google.gdata.util.AuthenticationException.<init>(AuthenticationException.java:67) ~[gdata-core-1.0-1.47.1.jar:na]
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:608) ~[gdata-core-1.0-1.47.1.jar:na]
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564) ~[gdata-core-1.0-1.47.1.jar:na]
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560) ~[gdata-core-1.0-1.47.1.jar:na]
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538) ~[gdata-core-1.0-1.47.1.jar:na]
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536) ~[gdata-core-1.0-1.47.1.jar:na]
at com.google.gdata.client.Service.getFeed(Service.java:1135) ~[gdata-core-1.0-1.47.1.jar:1.47.1]
at com.google.gdata.client.Service.getFeed(Service.java:1077) ~[gdata-core-1.0-1.47.1.jar:1.47.1]
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:676) ~[gdata-core-1.0-1.47.1.jar:1.47.1]
at com.google.gdata.client.Service.query(Service.java:1237) ~[gdata-core-1.0-1.47.1.jar:1.47.1]
at com.google.gdata.client.Service.query(Service.java:1178) ~[gdata-core-1.0-1.47.1.jar:1.47.1]
Run Code Online (Sandbox Code Playgroud)
我们设法添加了一个在这个NPE上尝试令牌刷新的包装器.它有所帮助,但是当刷新失败时仍有很多情况:
credential.refreshToken() == false
Run Code Online (Sandbox Code Playgroud)
当我们refreshToken()在调试器中运行时,我们看到它executeRefreshToken()在没有异常的情况下执行但是tokenResponse==null被返回.结果refreshToken() …
google-data-api ×10
c# ×2
javascript ×2
oauth ×2
authsub ×1
django ×1
gdata ×1
google-api ×1
google-docs ×1
google-oauth ×1
node.js ×1
objective-c ×1
php ×1
picasa ×1
pys60 ×1
python ×1
symbian ×1
xcode4.3 ×1