Skip to content

Commit

Permalink
docs: update thread_safety.md (#1568)
Browse files Browse the repository at this point in the history
An authorized http is required to build service, otherwise it will fail to read meta data.
  • Loading branch information
howard-repos committed Oct 21, 2021
1 parent a9f93ae commit 0b400f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/thread_safety.md
Expand Up @@ -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')
Expand Down

0 comments on commit 0b400f9

Please sign in to comment.