标签: google-api-client

将Google Custom Search API与Ruby google-api-client一起使用

作为我目前参与的人物搜索项目的一部分,我需要编写一个ruby脚本,可以将搜索查询发送到Google Custom Search API并存储搜索结果以进行处理.我找到了Ruby google-api-client gem(http://code.google.com/p/google-api-ruby-client/)并安装了它,但是,尽管已经彻底阅读了文档,但我感到很茫然.至于如何执行自定义搜索API调用.这是我第一次尝试使用Google API而且我发现这个过程有点压倒性,有没有人可以提供一些示例代码供我学习?谢谢

ruby google-api-client

5
推荐指数
1
解决办法
2746
查看次数

AbstractGoogleClient:致命信号11(SIGSEGV)

06-06 00:05:02.955: I/DEBUG(5660): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-06 00:05:02.955: I/DEBUG(5660): Build fingerprint: 'google/occam/mako:4.2.2/JDQ39/573038:user/release-keys'
06-06 00:05:02.955: I/DEBUG(5660): Revision: '11'
06-06 00:05:02.955: I/DEBUG(5660): pid: 3787, tid: 3806, name: pool-1-thread-1  >>> com.example.android <<<
06-06 00:05:02.955: I/DEBUG(5660): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
06-06 00:05:03.055: I/DEBUG(5660):     r0 74e4ab1c  r1 ffffffff  r2 00000008  r3 7293e04d
06-06 00:05:03.055: I/DEBUG(5660):     r4 7293e04d  r5 7293e04e  r6 00000000  r7 7293e04d
06-06 00:05:03.055: I/DEBUG(5660):     r8 …
Run Code Online (Sandbox Code Playgroud)

android google-api-client

5
推荐指数
1
解决办法
2822
查看次数

如何在django中存储google oauth令牌:存储或数据库

Google API python客户端对Django具有特殊的支持,在Google(https://developers.google.com/api-client-library/python/guide/django)提供的示例中,oauth2client.django_orm.Storage类为用于存储和检索凭据对象。

然而,我发现很多的例子(https://github.com/jgmize/django-google-drive/tree/master/gdrive/gdoauth2https://github.com/praekelt/django-google-credentials/tree/ master / google_credentials等)将凭据放入用户个人资料的CredentialsField字段中,并将其保存到数据库中。

两种方法的优点/缺点是什么?有偏好吗?

谢谢

django google-api google-api-client oauth2client google-oauth

5
推荐指数
1
解决办法
1092
查看次数

为什么我从google adwords api收到CERTIFICATE_VERIFY_FAILED?

为什么google adwords api停止通话此链接:

https://adwords.google.com/api/adwords/mcm/v201502/CustomerService?wsdl
Run Code Online (Sandbox Code Playgroud)

有了这个错误 - 我应该在之前和之后加载一些证书吗?

urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
Run Code Online (Sandbox Code Playgroud)

使用Python 2.7.10.

完整源代码: create_adwords_client_without_yaml.py

完整的错误代码:

Traceback (most recent call last):
  File "C:/Users/Crezary Wagner/PycharmProjects/learn-adwords/src/examples/create_adwords_client_without_yaml.py", line 56, in <module>
    CLIENT_CUSTOMER_ID)
  File "C:/Users/Crezary Wagner/PycharmProjects/learn-adwords/src/examples/create_adwords_client_without_yaml.py", line 50, in main
    customer = adwords_client.GetService('CustomerService').get()
  File "C:\root\Python27\lib\site-packages\googleads\adwords.py", line 256, in GetService
    proxy=proxy_option, cache=self.cache, timeout=3600)
  File "C:\root\Python27\lib\site-packages\suds\client.py", line 115, in __init__
    self.wsdl = reader.open(url)
  File "C:\root\Python27\lib\site-packages\suds\reader.py", line 150, in open
    d = self.fn(url, self.options)
  File "C:\root\Python27\lib\site-packages\suds\wsdl.py", line 136, in __init__
    d = …
Run Code Online (Sandbox Code Playgroud)

google-api google-adwords python-2.7 google-api-client google-api-python-client

5
推荐指数
1
解决办法
1万
查看次数

在API级别19到22的android中检索当前位置

我在项目中使用下面的代码来检索用户的当前位置.但是,这似乎适用于我的API级别23的测试设备,但在我的API级别19到22的测试设备上不起作用.对位置的请求将返回null,因此将我放在坐标0,0 ..

如何获得API级别19到22的正确坐标?

package be.enventorslab.pingvalue;

import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.location.Location;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

import be.enventorslab.pingvalue.functions.Functions;

public class NearbyLocationActivity extends AppCompatActivity
        implements GoogleApiClient.ConnectionCallbacks,
        GoogleApiClient.OnConnectionFailedListener,
        LocationListener {

        public static final String TAG = NearbyLocationActivity.class.getSimpleName();

        private final static int CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000;

        private GoogleMap mMap;

        private GoogleApiClient mGoogleApiClient;
        private LocationRequest mLocationRequest;

        Bundle bundle;

        @Override
        protected void onCreate(Bundle …
Run Code Online (Sandbox Code Playgroud)

android google-api-client android-maps-v2

5
推荐指数
0
解决办法
402
查看次数

android模拟位置不适用于locationservices.fusedlocationapi

从谷歌商店下载并使用“Fake Gps”后,我想为教育目的创建一个。

我正在使用 GoogleApiClient FusedLocationAPI 来获取我的当前位置并创建一个模拟位置。我能够获得我当前的位置,但无法模拟位置。

public class GoogleApiClientGeoLocation implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
    private GoogleApiClient googleApiClient;

    public GoogleApiClientGeoLocation(Context activity) {
        googleApiClient = new GoogleApiClient.Builder(activity, this, this).addApi(LocationServices.API).build();
        ....
    }

    public void connect() {
        if (googleApiClient != null) {
           googleApiClient.connect();
        }
    }

    public void disconnect() {
        googleApiClient.disconnect();
    }

    @Override
    public void onConnected(@Nullable Bundle bundle) {
        LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this);
    }

    @Override
    public void onLocationChanged(Location location) {
        Log.e("TAG","Location changed"+location.getLatitude() + ", "+ location.getLongitude());
    }

    private static final String PROVIDER = LocationManager.NETWORK_PROVIDER;//"flp";
    private static …
Run Code Online (Sandbox Code Playgroud)

android location google-api-client fusedlocationproviderapi

5
推荐指数
1
解决办法
1178
查看次数

如何为 youtube python api 使用 refresh_token?

所以我通过这种方式获得了一个刷新令牌,我可以保留它吗?

如果是这样,我下次如何使用它,这样我就不需要打开浏览器了?

现在我正在考虑直接创建 OAuth2Credentials 对象,这是正确的方法吗?

from urllib.parse import urlparse, parse_qs
from oauth2client.client import flow_from_clientsecrets, OAuth2Credentials
from oauth2client.file import Storage
from oauth2client.tools import argparser, run_flow
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.contrib import gce
import httplib2
import webbrowser

CLIENT_SECRETS_FILE = "bot_credentials.json"
flow = client.flow_from_clientsecrets(
     CLIENT_SECRETS_FILE,
    scope=scope,
redirect_uri='http://127.0.0.1:65010')
flow.params['include_granted_scopes'] = 'true'
flow.params['access_type'] = 'offline'
auth_uri = flow.step1_get_authorize_url()
webbrowser.open(auth_uri)
url = input('Please enter the redirected url with code')
code = get_url_param(url, 'code')
if code is None:
    print('there is an error …
Run Code Online (Sandbox Code Playgroud)

python youtube-api google-api-client

5
推荐指数
1
解决办法
1578
查看次数

Android Activity 正在重新启动

我正在制作一个应用程序,其中的一项功能是每 10 秒更新一次用户位置。到目前为止,应用程序没有更新它的位置,因为在检索位置之前,活动已暂停并重新启动。我不明白为什么要重新启动活动。我最好的猜测是,由于没有很多事情发生,操作系统正在暂停活动,但是什么会触发活动重新启动?我之前尝试过构建应用程序,然后我从头开始,因为我犯了太多错误,但即使如此,我以前也没有遇到过这个问题。

D/selectRouteAndTransportMethod: On Start
D/myLocation: Connection Requested
D/selectRouteAndTransportMethod: Connecting
D/selectRouteAndTransportMethod: registered
D/myLocation: Connection Requested
V/FA: Activity resumed, time: 8562145
V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 32
V/FA: Activity paused, time: 8562177
V/FA: onActivityCreated
D/Activity: performCreate Call secproduct feature valuefalse
D/Activity: performCreate Call debug elastic valuetrue
D/selectRouteAndTransportMethod: On Start
D/myLocation: Connection Requested
D/selectRouteAndTransportMethod: Connecting
D/selectRouteAndTransportMethod: registered
D/myLocation: Connection Requested
V/FA: Activity resumed, time: 8562374
D/myLocation: OnConnected
D/myLocation: Permission Was Granted
V/FA: Screen exposed …
Run Code Online (Sandbox Code Playgroud)

java lifecycle android google-api-client android-activity

5
推荐指数
1
解决办法
4414
查看次数

gson 得到了 com.google.gson.internal.LinkedTreeMap

我有以下json

{
  "kind": "youtube#channelListResponse",
  "etag": "\"cbz3lIQ2N25AfwNr-BdxUVxJ_QY/QM4kW8nb-nymx1biZnF8bIvgOfE\"",
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 1
  },
  "items": [
    {
      "kind": "youtube#channel",
      "etag": "\"cbz3lIQ2N25AfwNr-BdxUVxJ_QY/y82-gQyDEMJUwKI8hgUfyTzHck8\"",
      "id": "UC_x5XG1OV2P6uZZ5FSM9Ttw",
      "snippet": {
        "title": "Google Developers",
        "description": "The Google Developers channel, offers lessons, talks, the latest news & best practices. Learn Android, Chrome,  Web Development, Polymer, Performance, iOS & more!\n\nTake advantage of this resource by subscribing to the official Google Developers channel here: https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw?sub_confirmation=1\n \nFollow Google Developers on Twitter: https://twitter.com/googledevs\n\nFollow Google Developers on Google+: https://plus.google.com/+GoogleDevelopers\n\nCheck out the Google Developers …
Run Code Online (Sandbox Code Playgroud)

android json gson google-api-client jackson2

5
推荐指数
0
解决办法
506
查看次数

为什么google-api-client依赖于guava-jdk5?

我在Maven依赖项中依赖于Guava:

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>23.3-jre</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我还依赖于依赖关系中的Google API客户端:

<dependency>
    <groupId>com.google.api-client</groupId>
    <artifactId>google-api-client</artifactId>
    <version>1.23.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

但由于一些奇怪的原因,这具有以下依赖性:

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava-jdk5</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)

现在我的WAR结束了两个Guava JAR:

  • 番石榴23.3 jre.jar
  • 番石榴jdk5-17.0.jar

这给出了几个问题,因为在guava-jdk5-17.0.jar编译代码时运行时更喜欢guava-23.3-jre.jar.

为什么Google API Client依赖于Guava for JDK5?拥有两个版本会不会更有意义,例如:

  • google-api-client 这取决于常规番石榴,最好是版本23.3(截至目前)
  • google-api-client-jdk5 这取决于Guava的JDK5

java google-api maven google-api-java-client google-api-client

5
推荐指数
1
解决办法
1099
查看次数