我正在尝试将图像文件上传到谷歌驱动器...代码;
function upload() {
var url= // url for image
var contents=UrlFetchApp.fetch(url).getContent() // trying to get image content
var base = 'https://docs.google.com/feeds'
var fetchArgs = googleOAuth_('docs', base);
fetchArgs.method='POST'
fetchArgs.contentType='image/jpeg'
var xml={title :"image",content:contents}
fetchArgs.payload=xml
var fileURL='https://www.googleapis.com/upload/drive/v2/files?uploadType=media'
UrlFetchApp.fetch(fileURL, fetchArgs)
}
function googleOAuth_(name,scope) {
var oAuthConfig = UrlFetchApp.addOAuthService(name);
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setConsumerKey(consumerKey);
oAuthConfig.setConsumerSecret(consumerSecret);
return {oAuthServiceName:name, oAuthUseToken:"always"};
}
当我运行此代码时,我收到此错误:
返回代码 403 的请求失败。服务器响应:{“错误”:{“错误”:[{“域”:“usageLimits”,“原因”:“dailyLimitExceededUnreg”,“消息”:“未验证使用的每日限制已超过。继续使用需要注册。", "extendedHelp": " https://code.google.com/apis/console " } ], "code": 403, "message": "Daily Limit for Unauthenticated Use Exceeded. 继续使用需要报名。” } }
我做错了什么,我没有得到这个....请给我一些可行的解决方案