google-api

How can I limit the number of returned Google search results in this C# program?

妖精的绣舞 提交于 2019-12-24 07:56:43
问题 I just want to return four results with the following C# snippet. How can I accomplish this? I know I could probably just parse the returned results, but I'd rather just grab only four to begin with, if that's possible. var searchTerm = "pizza boxes"; using (var web = new WebClient()) { web.Headers.Add("Referrer", "http://localhost:49360/"); var result = web.DownloadString(String.Format( "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={0}", searchTerm)); Console.WriteLine(result)

Google Drive API (.NET) - Transfer ownership from Service Account to Domain user

烂漫一生 提交于 2019-12-24 07:37:28
问题 I am creating file on Google drive with .NET client API with Service account. string[] scopes = new string[] { DriveService.Scope.Drive }; GoogleCredential credential; using (var stream = new FileStream(Directory.GetCurrentDirectory() + "/Resources/GoogleCredentials.json", FileMode.Open, FileAccess.Read)) { credential = GoogleCredential.FromStream(stream).CreateScoped(scopes); } DriveService drive = new DriveService(new BaseClientService.Initializer() { HttpClientInitializer = credential, });

Stopped getting refresh token from google's API

我只是一个虾纸丫 提交于 2019-12-24 07:17:06
问题 So I have a web app with ruby on rails that connects to google drive's API. Up until now, it used to receive the refresh token, since one of the paramenters I was using was offline. But recently it stopped getting it. The url that is being sent is this: Redirected to https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=ID&options=%7B:access_type=%3E%22offline%22,%20:approval_prompt=%3E%22force%22%7D&redirect_uri=http://localhost:3000/oauth2callbackdrive&response_type=code

Avoiding DefaultCredentialsError when using google bigquery API

隐身守侯 提交于 2019-12-24 07:15:47
问题 I'm trying to execute an SQL query on some bigquery table. I keep getting a DefaultCredentialsError when trying to instantiate a bigquery client object. For example by doing this: from google.cloud import bigquery client = bigquery.Client.from_service_account_json('service_account_key.json') Or by doing this: from oauth2client.service_account import ServiceAccountCredentials key = open('service_account_key.json', 'rb').read() credentials = ServiceAccountCredentials( 'my_email', key, scope=

You are not authorized for this operation. Invalid access token DialogFlow v2

痴心易碎 提交于 2019-12-24 07:07:16
问题 I am trying to use DialogFlow v2 endpoint but for some reason I am getting not authorized message, eventhou I am able to generate access token using the following command: Initially I am running this to authorize the service for my local machine to be able to authorize to the service: gcloud auth activate-service-account --key-file=<service-account-key-file.json> then I get access token by following command: gcloud auth print-access-token and this access token I am attaching on the following

How to create a new contact via Google Contacts API?

喜欢而已 提交于 2019-12-24 06:58:13
问题 I am creating a new contact as described in Google Contacts API . Specifically, I do a POST to https://www.google.com/m8/feeds/contacts/default/full . The content that I POST is taken directly from Google Contacts API document and also copied below. The problem is Google puts the newly created contact under "Other Contacts". That is if I open https://contacts.google.com/ in the browser, the new contact is not shown. I have to go to the sidebar in the left, click "More" and then click "Other

403 Insufficient permissions error while trying to get Google Analytics data

亡梦爱人 提交于 2019-12-24 06:45:00
问题 I'm developing RoR application, which allows user to login with google account and download/upload report data from one of his analytics account. I use omniauth-google-oauth2 gem for authorization with google account and google-api-client for interaction with Google Analytics. The problem is that when I try to get accounts list with analytics.management.accounts.list method, passing google token as one of authorization parameters, GA responds with 403 Insufficient permissions error. I suppose

How to extend activity from MapActivity in Android using MOTODEV?

耗尽温柔 提交于 2019-12-24 06:40:42
问题 I am using MotoDev Studio for Android Development and I am trying to Extend my Activity from MapActivity. But MotoDev does not Allow me to do this. Can any One Tell me why this is so? On the other hand in Eclipse this is possible for me using Google Api. Plz Help me out. 回答1: MOTODEV Studio doesn't prevent you from extending classes. It's just Eclipse + ADT and some other plugins that we created. I would advise following the direction that @PeterKnego mentioned. Just add the external library

CORS request is not working on google directions API

此生再无相见时 提交于 2019-12-24 06:37:56
问题 Every time I try to get data from the directions API, I get No 'Access-Control-Allow-Origin' header is present on the requested resource. I've tried to do the same request to the geocode API and it works. This is the code that I'm using: var xhr = new XMLHttpRequest(); xhr.open('GET', 'https://maps.googleapis.com/maps/api/directions/json?origin='+encodeURIComponent(data.origin)+'&destination='+encodeURIComponent(data.destination)+'&key='+encodeURIComponent(data.key), true); xhr.send(); 回答1:

Google Cloud Search Indexer “Indexer: java.io.IOException: Job failed!”

笑着哭i 提交于 2019-12-24 06:25:54
问题 I am a young developer, I am relatively new to Google Cloud Platform products, and in particular to Google Cloud Search. I have tried to follow also https://developers.google.com/cloud-search/docs/guides/apache-nutch-connector tutorial. What I have done it’s simply reproduce the tutorial modifying the nutch-site.xml file like that <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration>