diff --git a/CHANGELOG.md b/CHANGELOG.md index b602d22dad8..82015acca35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.12.8](https://www.github.com/googleapis/google-api-python-client/compare/v1.12.7...v1.12.8) (2020-11-18) + + +### Documentation + +* add httplib2 authorization to thread_safety ([#1005](https://www.github.com/googleapis/google-api-python-client/issues/1005)) ([205ae59](https://www.github.com/googleapis/google-api-python-client/commit/205ae5988bd89676823088d6c8a7bd17e3beefcf)), closes [#808](https://www.github.com/googleapis/google-api-python-client/issues/808) [#808](https://www.github.com/googleapis/google-api-python-client/issues/808) + ### [1.12.7](https://www.github.com/googleapis/google-api-python-client/compare/v1.12.6...v1.12.7) (2020-11-17) diff --git a/docs/thread_safety.md b/docs/thread_safety.md index 50bfad05bf5..69f369e21ca 100644 --- a/docs/thread_safety.md +++ b/docs/thread_safety.md @@ -9,14 +9,20 @@ The google-api-python-client library is built on top of the [httplib2](https://g The easiest way to provide threads with their own `httplib2.Http()` instances is to either override the construction of it within the service object or to pass an instance via the http argument to method calls. ```python +import google.auth +import googleapiclient +import google_auth_httplib2 +import httplib2 +from googleapiclient import discovery + # Create a new Http() object for every request def build_request(http, *args, **kwargs): - new_http = httplib2.Http() - return apiclient.http.HttpRequest(new_http, *args, **kwargs) -service = build('api_name', 'api_version', requestBuilder=build_request) + new_htpp = 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) # Pass in a new Http() manually for every request -service = build('api_name', 'api_version') -http = httplib2.Http() +service = discovery.build('api_name', 'api_version') +http = google_auth_httplib2.AuthorizedHttp(credentials, http=httplib2.Http()) service.stamps().list().execute(http=http) -``` \ No newline at end of file +``` diff --git a/setup.py b/setup.py index f0ff03fa122..bf0a8f42131 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -version = "1.12.7" +version = "1.12.8" setup( name="google-api-python-client",