2

Using the discovery.build() from the google-api-python-client (version 1.6.2) in my web app is causing timeouts. Running the following piece of code

import httplib2
from apiclient import discovery

http = httplib2.Http()
discovery.build('classroom', 'v1', http=http)

takes about 80 seconds(!) – the timeout on my web server is 30 seconds.

I believe the call the Google API client makes is:

http = httplib2.Http()
response, content = http.request(
    'https://www.googleapis.com/discovery/v1/apis/classroom/v1/rest',
    'GET',
    body=None,
    headers={},
)

which also takes about 80 seconds, and retrieves about 141 KiB of data.

Whereas the equivalent curl:

curl -H 'accept-encoding: gzip, deflate' \
     'https://www.googleapis.com/discovery/v1/apis/classroom/v1/rest'

Takes 0.5 seconds.

Why is it taking so long? And what can I do to prevent it – is there a faster way?

qff
  • 5,524
  • 3
  • 37
  • 62
  • What did you do to fix it? – Ravindranath Akila Nov 22 '17 at 07:25
  • I don't think I ever figured it out. Seemingly it has resolved it self, even though I was able to trigger it very consistently at the time – are you having this 80 second wait problem? – qff Nov 23 '17 at 11:48
  • I was experiencing this as well, and, on a hunch rebooted my system. It seemed to do the trick. It looks like this could be related: https://stackoverflow.com/q/23680767/27657 – javamonkey79 Jan 03 '18 at 19:18
  • I'm having this problem. It's timing out more and more often to the point where it is basically nonfunctional. Rebooting didn't help. – Adam Starrh Oct 26 '18 at 14:42

0 Answers0