diff options
author | 数组越界 <ihavenoemail@163.com> | 2021-10-22 03:55:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-21 15:55:34 -0400 |
commit | 0b400f97be45808ade211ca8291b2e1d9476bde1 (patch) | |
tree | 801a72bf6395649da5b8cfe217d46299451ee08a | |
parent | a9f93ae8d68534e5b4882fd750d21d2654cbc3a1 (diff) | |
download | google-api-python-client-0b400f97be45808ade211ca8291b2e1d9476bde1.tar.gz |
docs: update thread_safety.md (#1568)
An authorized http is required to build service, otherwise it will fail to read meta data.
-rw-r--r-- | docs/thread_safety.md | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/thread_safety.md b/docs/thread_safety.md index d29ba71bf..514972951 100644 --- a/docs/thread_safety.md +++ b/docs/thread_safety.md @@ -19,7 +19,8 @@ from googleapiclient import discovery def build_request(http, *args, **kwargs): new_http = google_auth_httplib2.AuthorizedHttp(credentials, http=httplib2.Http()) return googleapiclient.http.HttpRequest(new_http, *args, **kwargs) -service = discovery.build('api_name', 'api_version', requestBuilder=build_request) +authorized_http = google_auth_httplib2.AuthorizedHttp(credentials, http=httplib2.Http()) +service = discovery.build('api_name', 'api_version', requestBuilder=build_request, http=authorized_http) # Pass in a new Http() manually for every request service = discovery.build('api_name', 'api_version') |