0

We are using the Google Drive .NET SDK to read a bunch of Google Drive folders publicly shared with us to download images for a client of ours. The application is a simple .NET console application that uses an API key with the SDK since we aren't doing any user authentication, etc.

        _driveService = new DriveService(new BaseClientService.Initializer()
        {
            ApiKey = googleApiKey,
            ApplicationName = ApplicationName
        });

We simply get a list of images from the Google Drive folders and loop through them downloading each image via:

var request = _driveService.Files.Get(fileId);
request.MediaDownloader.ProgressChanged += (IDownloadProgress progress) =>
                        {
                            switch (progress.Status)
                            {
                                case DownloadStatus.Downloading:
                                    {
                                        break;
                                    }
                                case DownloadStatus.Completed:
                                    {
                                        our logic here
                                        break;
                                    }
                                case DownloadStatus.Failed:
                                    {
                                        
                                        break;
                                    }
                            }
                        };
                        request.Download(stream);

This was working great until recently we are receiving a DownloadStatus.Failed status and the Exception is a HTML message containing:

<h1>We're sorry...</h1>
<p>... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.</p></div><div style="margin-left: 4em;">See <a href="https://support.google.com/websearch/answer/86640">Google Help</a> for more information.

Now the error doesn't happen immediately. We can do about 50 requests successfully before that error message starts to appear. We have no idea how long we have to "wait" before we can do another request, but we're out of ideas at this point and very frustrated considering we're using the Google SDK as well as Google API key, which has IP restrictions. Again, we're using an API key, not OAuth since this is a console application, and barely do 1,000 file get requests in a day, which is well below any rate limits. We even tried a one minute delay between file requests, but that doesn't stop the application from receiving the failed status.

Any idea how we can prevent getting this message from a console application, using an API key?

  • Can you verify you quota usage and check if you haven't hit any limits? – Aerials Aug 27 '20 at 08:33
  • Absolutely. In the last 30 days we made a total of 50,396 requests to the Google Drive API. In the last 2 days, we made a total of 294 requests. Our application only runs 1 time daily to check for and download any new images by our client and it consistently starts receiving the message above after around 50-75 requests. – RecursiveThoughts Aug 28 '20 at 15:05
  • Does this answer your question? [Google Drive API - We're sorry...... but your computer or network may be sending automated queries](https://stackoverflow.com/questions/60284158/google-drive-api-were-sorry-but-your-computer-or-network-may-be-sending) – Aerials Sep 02 '20 at 09:25
  • Unfortunately not. I had found and read that article as well. We are using an API key and not an Oauth Access Token as the files we are accessing are publicly accessible. That's the major difference, along with the fact that this is using Google's .NET SDK. Whether the alt=media flag gets added to the request or not, is out of our purview as we're using the latest version of Google's .NET SDK and we aren't building URLs manually via Javascript, etc. Now I wouldn't discount the probability that this issue did start happening in the February 2020 timeframe though and could be somewhat connected. – RecursiveThoughts Sep 03 '20 at 14:13
  • Have you gotten any further with this or have some more info? – Aerials Sep 08 '20 at 14:34
  • None at all unfortunately. I opened a request with Google here [link](https://issuetracker.google.com/issues/166657557) and they just came back that it is intended behavior and we're making too many requests, despite making only a couple hundred a day. I'm waiting on clarification and will try to contact GSuite Support. – RecursiveThoughts Sep 09 '20 at 15:32

2 Answers2

0

It looks like the issue here might in fact be related to your domain so just like mentioned in the issue you shared, it'd be best to contact GSuite Support.

ale13
  • 5,679
  • 3
  • 10
  • 25
0

So I talked to GSuite Support and they said it's not their area. "We don't support the Drive API and the only way would be subscribing to Google Cloud Platform Support, and escalating our case with them. You can find the plans here https://cloud.google.com/support, because it is a paid subscription."

So I went to associate our billing account (we do Google Ads as well) with the Google Developer account for this project, that has the API key, in addition to take advantage of a Google Cloud Platform $300 credit that was advertised at the top. It was interesting because there was already a billing account associated that was called "Google XYZ Platform Transition Account".

Once I removed this "Google Transition Account" and associated our own billing account, we stopped receiving the errors.

So in the end, this had nothing to do with our actual API calls or quantity of calls, but something on Google's side with this "Transition Account" versus having our own billing account setup (even though we still aren't paying anything).

I hope this helps someone else down the road.