You may know that the Google API Python Client is built on httplib2. This is a reasonable general choice, but the tight coupling is unhelpful in situations where a different HTTP library, or an entirely different approach to network programming should be used. An example of this is Twisted.
Aside: I won't be going on about how awesome Twisted is, but let's just take it for granted that it is so awesome that I could not write this application without it.
Httplib2 is blocking, and that makes it incompatible with being run inside the Twisted reactor. Fortunately we are only the latest person to have this problem, and a solution exists:
api_call = drive.files().list() def on_list(resp): for item in resp['items']: print item['title'] d = deferToThread(api_call.execute) d.addCallback(on_list)
*Did I mention? I am 100% happy.
Please comment on this post in Google+