Thread Safety

This page contains important information about the thread safety of this library.

The httplib2.Http() objects are not thread-safe

The google-api-python-client library is built on top of the httplib2 library, which is not thread-safe. Therefore, if you are running as a multi-threaded application, each thread that you are making requests from must have its own instance of httplib2.Http().

Credential Storage objects are thread-safe

All Storage objects defined in this library are thread-safe, and multiple processes and threads can operate on a single store.

In some cases, this library automatically refreshes expired OAuth 2.0 tokens. When many threads are sharing the same set of credentials, the threads cooperate to minimize the total number of token refresh requests sent to the server.