Skip to content

Commit 0b400f9

Browse files
authored
docs: update thread_safety.md (#1568)
An authorized http is required to build service, otherwise it will fail to read meta data.
1 parent a9f93ae commit 0b400f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/thread_safety.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ from googleapiclient import discovery
1919
def build_request(http, *args, **kwargs):
2020
new_http = google_auth_httplib2.AuthorizedHttp(credentials, http=httplib2.Http())
2121
return googleapiclient.http.HttpRequest(new_http, *args, **kwargs)
22-
service = discovery.build('api_name', 'api_version', requestBuilder=build_request)
22+
authorized_http = google_auth_httplib2.AuthorizedHttp(credentials, http=httplib2.Http())
23+
service = discovery.build('api_name', 'api_version', requestBuilder=build_request, http=authorized_http)
2324

2425
# Pass in a new Http() manually for every request
2526
service = discovery.build('api_name', 'api_version')

0 commit comments

Comments
 (0)