我正在尝试使用OAuth从python应用程序中获取Gmail原子提要.我有一个可以下载Google阅读器Feed的工作应用程序,我认为应该只是更改范围和Feed网址.替换URL后,我仍然可以成功获取请求和访问令牌,但是当我尝试使用访问令牌获取源时,我收到"401 Unauthorized"错误.这是我的简单测试程序:
import urlparse
import oauth2 as oauth
scope = "https://mail.google.com/mail/feed/atom/"
sub_url = scope + "unread"
request_token_url = "https://www.google.com/accounts/OAuthGetRequestToken?scope=%s&xoauth_displayname=%s" % (scope, "Test Application")
authorize_url = 'https://www.google.com/accounts/OAuthAuthorizeToken'
access_token_url = 'https://www.google.com/accounts/OAuthGetAccessToken'
oauth_key = "anonymous"
oauth_secret = "anonymous"
consumer = oauth.Consumer(oauth_key, oauth_secret)
client = oauth.Client(consumer)
# Get a request token.
resp, content = client.request(request_token_url, "GET")
request_token = dict(urlparse.parse_qsl(content))
print "Request Token:"
print " - oauth_token = %s" % request_token['oauth_token']
print " - oauth_token_secret = %s" % request_token['oauth_token_secret']
print
# …Run Code Online (Sandbox Code Playgroud) 我正在使用谷歌的GData API,以便从我的应用程序上传视频到youtube.上传工作正常,但上传的视频质量仅为360p,而原始视频的质量为720p.
这是否按预期工作?如果是这样,有什么方法可以让我的应用程序上传HQ电影吗?
这是我用来实现视频上传的代码,如果有任何帮助的话.
GDataYouTubeMediaGroup *mediaGroup = [GDataYouTubeMediaGroup mediaGroup];
[mediaGroup setMediaTitle:title];
[mediaGroup setMediaDescription:desc];
[mediaGroup addMediaCategory:category];
[mediaGroup setMediaKeywords:keywords];
[mediaGroup setIsPrivate:NO];
NSString *mimeType = [GDataUtilities MIMETypeForFileAtPath:outputURL.relativePath defaultMIMEType:@"video/quicktime"];
GDataEntryYouTubeUpload *entry;
entry = [GDataEntryYouTubeUpload uploadEntryWithMediaGroup:mediaGroup data:data MIMEType:mimeType slug:filename];
SEL progressSel = @selector(ticket:hasDeliveredByteCount:ofTotalByteCount:);
[service setServiceUploadProgressSelector:progressSel];
GDataServiceTicket *ticket;
ticket = [service fetchEntryByInsertingEntry:entry forFeedURL:url delegate:self didFinishSelector:@selector(uploadTicket:finishedWithEntry:error:)];
Run Code Online (Sandbox Code Playgroud)
布伦顿
我已经使用wamp(Apache服务器)配置了openssl.但是当我使用gdata api时,我遇到了以下错误.
( ! ) Fatal error: Uncaught exception 'Zend_Http_Client_Adapter_Exception' with message ' in C:\Zend_1_11_11\library\Zend\Http\Client\Adapter\Socket.php on line 234
( ! ) Zend_Http_Client_Adapter_Exception: Unable to Connect to ssl://accounts.google.com:443. Error #10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Zend_1_11_11\library\Zend\Http\Client\Adapter\Socket.php on line 234
Run Code Online (Sandbox Code Playgroud)
有人帮我这个......
我已经能够使用client.programmaticlogingdata下载包中的示例/电子表格,使用gdata python 函数登录Google电子表格.
现在我无法登录我的企业gapps'me@mycompany.com'我是否必须通过任何其他武器?我试过帐户类型托管没有工作.
我尝试oath2从gui 创建密钥,我生成了客户端ID和电子邮件ID.在gdata中运行oauth示例会询问consumerkey和secret密钥.有人可以就此提出建议吗?
我正在尝试使用Google的Objective-C Youtube API来获取youtube频道的播放列表 - 没有运气.
- 我从以下网址下载了Google的官方API:http: //code.google.com/p/gdata-objectivec-client/source/browse/#svn%2Ftrunk%2FExamples%2FYouTubeSample
但示例应用程序并没有真正做任何事情 - 它甚至不是iOS示例应用程序.似乎是一个Mac OS应用程序.它的Read-Me文件说:"这个示例应该自动构建并复制GTL.framework,作为构建和运行过程的一部分."
好的......然后是什么?
你如何在iPhone应用程序中使用它?
我没有找到任何实际的指示来完成这项工作.
知道我们应该在这做什么吗?
鉴于几个.xls具有不同页数的文件,我读他们到R使用read.xls从gdata包.我有两个相关的问题(解决第二个问题应解决第一个问题):
.xls文件将有多少张纸,实际上这个值会因文件而异.现在,要解决(1),我正在使用try()并迭代工作表编号,直到我遇到错误.
如何获取工作表名称列表以便我可以迭代它们?
简单问题:
我通过javascript使用Youtube gdata来评论,回复和喜欢/不喜欢的视频.到目前为止一切正常!
但是,我试图让用户特别喜欢和不喜欢COMMENTS(就像在本机youtube.com上一样).但我实际上找不到解释如何完成的文档.
我尝试发送以下内容 ...://gdata.youtube.com/feeds/api/videos/[video_id]/ratings
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:yt="http://gdata.youtube.com/schemas/2007">
<link rel="http://gdata.youtube.com/schemas/2007#in-reply-to"
type="application/atom+xml" href="<ID>"/>
<yt:rating value="like"/>
</entry>
Run Code Online (Sandbox Code Playgroud)
但没有快乐.任何帮助,将不胜感激!谢谢.
我即将开始一个需要一些简单的YouTube非写入数据操作的项目,比如收集用户的播放列表和视频.我读过它已YouTube 2.0 API被弃用,但我真的不想使用OAuthAPI 3.0所需的身份验证.
这是否意味着GDATA API已弃用(特别是:https://gdata.youtube.com/demo/index.html
我正在尝试通过Google .Net GData客户端库生成OAuth访问令牌.我一直在使用http://code.google.com/apis/gdata/docs/auth/oauth.html中的说明作为指导,所有内容一直在进行,直到我尝试拨打电话OAuthUtil.GetAccessToken( parameters ),我收到了"(400) )错误请求"网络例外.
不幸的是,它没有告诉我为什么这是一个糟糕的请求.所以,我对此感到困惑.我唯一的想法就是,因为我使用的是localhost网址,但它不起作用(虽然我已经在Google API控制台中注册了网址,但这样做似乎没问题).
我在这里做错了什么以及我应该做些什么才能做到正确?
该OAuthParameters对象被创建像这样(的敏感数据被审查,希望并不能使它很难回答):
BaseProperties:
oauth_consumer_key: <CLIENT_KEY>,
oauth_nonce: <NONCE>
oauth_signature_method: HMAC-SHA1
oauth_timestamp: 1330440325
oauth_token: <TOKEN>
oauth_verifier: <VERIFIER>
Callback: "http://localhost:57381/subscription_auth.aspx?c=google.calendar"
ConsumerKey: <CLIENT_KEY>
ConsumerSecret: <CLIENT_SECRET>
ExtraProperties
oauth_consumer_secret: <CLIENT_SECRET>
scope: https://docs.google.com/calendar/feeds/
oauth_callback: http://localhost:57381/subscription_auth.aspx?c=google.calendar
Nonce: <NONCE>
Scope: "https://docs.google.com/calendar/feeds/"
Signature: NULL
SignatureMethod: "HMAC-SHA1"
Timestamp: "1330440325"
Token: <TOKEN>
TokenSecret: NULL -- No Token Secret was returned from the callback.
Verifier: <VERIFIER>
Run Code Online (Sandbox Code Playgroud)
这转换为Web响应的标题,如下所示:
Authorization: OAuth oauth_version="1.0",
oauth_nonce=<NONCE>,
oauth_timestamp="1330441324",
oauth_consumer_key=<CLIENT_KEY>, …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Google Calendar API v3创建日历,如果它还不存在的话.我的实现成功检索了我的所有日历和事件,并可以更改日历,但我正在努力添加新日历.这是我为了尝试为用户添加新日历而做的事情:
...
var calendarService = new CalendarService(_authenticator);
var calendarId = "com.somedomain.somename.1234"; // Some random ID
try {
calendarManager.GetCalendar(calendarId); // No calandar found
} catch(GoogleCalandarServiceProxyException e){
// Ok, so far so good, calendar not found (that is correct) and I am here
var someCalendar = new Google.Apis.Calendar.v3.Data.CalendarListEntry {
Summary = "Some summary!",
Description = "A calendar descr.",
AccessRole = "writer",
BackgroundColor = "#E7323C",
Id = calendarId
};
calendarService.CalendarList.Insert(someCalendar).Fetch(); // Fetch to execute
}
Run Code Online (Sandbox Code Playgroud)
请求生成:
insert @ https://www.googleapis.com/calendar/v3/users/me/calendarList?alt=json&prettyPrint=true
Run Code Online (Sandbox Code Playgroud)
RequestError: …