Skip to content
Permalink
Browse files
docs: update thread_safety.md (#1568)
An authorized http is required to build service, otherwise it will fail to read meta data.
  • Loading branch information
jiahongchao committed Oct 21, 2021
1 parent a9f93ae commit 0b400f97be45808ade211ca8291b2e1d9476bde1
Showing with 2 additions and 1 deletion.
  1. +2 鈭1 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')

0 comments on commit 0b400f9

Please sign in to comment.