我一直在尝试使用Google App Engine,我正在尝试导入某些库以执行API命令.然而,我一直无法导入.当我尝试执行"来自apiclient.discovery import build"时,我的网站不再加载.当我在IDLE中进行本地测试时,此命令有效.
python google-app-engine google-api google-api-client google-api-python-client
我正在检索联系人
https://www.google.com/m8/feeds/contacts/default/full/(optional contactId)
但我需要通过电子邮件而不是id来获取联系人.
有办法吗?我已经尝试解决这个问题一段时间了,在文档中找不到任何帮助..
我一直在这里寻找答案:
https://developers.google.com/google-apps/contacts/v3/#retrieving_contacts_using_query_parameters
我正在考虑为用户编写一些Java代码来安装时间驱动的触发器(定期运行谷歌应用程序脚本).但无法找到用于操纵触发器的REST API.想知道是否有可能.谢谢.
桑杰
我正在使用(alpha)Ruby google-api-client与我们组织的Google Apps实例的各种服务进行交互.
我想发现配置服务 API,使用服务帐户验证用户身份,并更新其密码.
至今...
require 'google/api_client'
class GoogleProvisioningConnection
def initialize(user_email=nil)
@client = Google::APIClient.new
@provisioning = @client.discovered_api('???', 'v2') # what's it called? user?
key_file_name = 'mykey-privatekey.p12'
key = Google::APIClient::PKCS12.load_key(key_file_name, 'notasecret')
asserter = Google::APIClient::JWTAsserter.new(
'...@developer.gserviceaccount.com',
'???', # which url allows me access to their user?
key)
@client.authorization = asserter.authorize(user_email)
end
end
Run Code Online (Sandbox Code Playgroud)
使用哪个字符串@client.discovered_api来获取配置API?
当使用JWT断言器时,应该请求哪个服务URL?
谢谢
ruby google-api google-apps google-provisioning-api google-api-ruby-client
我正在使用这个PHP脚本将文件INSERT(上传)到我的Google云端硬盘,它的完美:
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_DriveService.php';
$drive = new Google_Client();
$drive->setClientId('XXX');
$drive->setClientSecret('YYY');
$drive->setRedirectUri('urn:ietf:wg:oauth:2.0:oob');
$drive->setScopes(array('https://www.googleapis.com/auth/drive'));
$gdrive = new Google_DriveService($drive);
$drive->setAccessToken(file_get_contents('token.json'));
$doc = new Google_DriveFile();
$doc->setTitle('Test');
$doc->setDescription('Test Document');
$doc->setMimeType('text/plain');
$content = file_get_contents('test.txt');
$output = $gdrive->files->insert($doc, array(
'data' => $content,
'mimeType' => 'text/plain',
));
print_r($output);
Run Code Online (Sandbox Code Playgroud)
现在我想更新(不上传)我现有的Google云端硬盘文件,我正在使用此脚本:
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_DriveService.php';
$drive = new Google_Client();
$drive->setClientId('XXX');
$drive->setClientSecret('YYY');
$drive->setRedirectUri('urn:ietf:wg:oauth:2.0:oob');
$drive->setScopes(array('https://www.googleapis.com/auth/drive'));
$gdrive = new Google_DriveService($drive);
$drive->setAccessToken(file_get_contents('token.json'));
$fileId = "ZZZ";
$doc = $gdrive->files->get($fileId);
$doc->setTitle('Test'); // HERE I GET THE ERROR "CALL TO A MEMBER …Run Code Online (Sandbox Code Playgroud) 我在Rails中使用OmniAuth通过YouTube OAuth对用户进行身份验证.
我有几个Google/YouTube帐户.其中两个登录就好了.其中两个失败了"invalid_credentials".
我不完全确定那个错误意味着什么; 它没有出现在OAuth 2规范中.
我已经使用多次登录成功登录了Google端的所有这四个帐户,因此我并没有错误地登录.其中两个帐户有效,因此我的API密钥不是很糟糕.
这是怎么回事?
我正在使用Google plus开发一个应用程序.因此我需要一个API密钥.我在API控制台中生成了密钥.现在使用该密钥,我将使用JSON中的JavaScript访问Google+中的一些数据.但在这种方法中,我的API密钥将公开显示.分享它可以吗?
我从这里获得的一些信息 https://developers.google.com/console/help/#UsingKeys
我目前正试图通过在PHP页面中使用Google Geocode API来获取地址的lat和lng参数.
我目前有以下代码,但不知何故,它不能通过PHP工作,而将生成的地址复制到谷歌浏览器似乎确实有效.
任何人都可以在下面的代码中看到错误吗?
提前致谢!
汤姆
================================================== ==
返回的错误是:
( [error_message] => The 'sensor' parameter specified in the request must be set to either 'true' or 'false'. [results] => Array ( ) [status] => REQUEST_DENIED ) An error has occured: 1
Run Code Online (Sandbox Code Playgroud)
旧代码与过时的部分:
$googleQuery = $_POST['txtAdres'] . ',+' . $_POST['txtPostcode'] . '+' . $_POST['txtStad'] . ',+' . $_POST['txtLand'];
$googleQuery = str_replace(' ', '+', $googleQuery);
// retrieve the latitude & longitude from the address
$url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($googleQuery) . '&sensor=false'; …Run Code Online (Sandbox Code Playgroud) 我正在研究Google Calendar API的.net版本的包装器.身份验证非常简单,在本地工作正常(localhost:port).
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId = "The id of my public website",
ClientSecret = "The secret of my public website",
},
new[] { CalendarService.Scope.Calendar },
"user",
CancellationToken.None).Result;
// Create the service.
var service = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential
});
return service.Events.List("primary").Execute().Items;
Run Code Online (Sandbox Code Playgroud)
但问题是,当相同的代码部署到生产环境时(当然,密码已更改),只要我尝试访问数据,应用程序就会挂起.没有例外,没有错误代码,它只是永远加载.
有没有人经历过这个?
我正在尝试使用Gmail API的节点库创建一个带有自定义ID的标签.API有一个用于设置自己的id的请求参数,但是当我尝试创建标签时,我得到错误:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Invalid request"
}
],
"code": 400,
"message": "Invalid request"
}
}
Run Code Online (Sandbox Code Playgroud)
当我不给id时,标签创建没有问题.但是出于我的目的,我需要设置标准标签ID.任何人都知道这里发生了什么,或者它只是api的错误/错误?您可以尝试为自己的帐户创建自己的标签,并在此处查看我正在讨论的更多信息:https://developers.google.com/apis-explorer/#p/gmail/v1/gmail.users.labels.create
创建标签的代码:
var service = Google.gmail({version : 'v1', auth : oauth2Client});
service.users.labels.create({
userId : 'user address here',
labelListVisibility : 'labelShow',
messageListVisibility : 'show',
name : 'label name here',
id : 'label id here'
}, function (err) {
if (err) {
throw err;
} else {
callback();
}
});
Run Code Online (Sandbox Code Playgroud)
谢谢!
google-api ×10
php ×3
oauth ×2
api-key ×1
asp.net ×1
c# ×1
contacts ×1
curl ×1
geocoding ×1
gmail ×1
gmail-api ×1
google-apps ×1
google-maps ×1
google-oauth ×1
google-plus ×1
oauth-2.0 ×1
python ×1
ruby ×1
search ×1
youtube-api ×1