From bdf5ea84a514c95f0d381d1d5bdb0464e246ff75 Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Tue, 29 Aug 2017 14:28:49 -0700 Subject: [PATCH] BatchHTTPRequest: only add access token header if we have it re-fixes #350. it was originally fixed by c669a3b9a89402c14179d11e587f5438b7209b5c following discussion in https://github.com/google/google-api-python-client/pull/351#discussion_r101218589 , but then that fix got lost in the next commit, https://github.com/google/google-api-python-client/pull/376/commits/282fc889956e42de8ec3e26aecbe39509f027333 . --- googleapiclient/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googleapiclient/http.py b/googleapiclient/http.py index f5d08a19a01..6aac030b8a7 100644 --- a/googleapiclient/http.py +++ b/googleapiclient/http.py @@ -1207,7 +1207,7 @@ def _serialize_request(self, request): if request.http is not None: credentials = _auth.get_credentials_from_http(request.http) - if credentials is not None: + if credentials is not None and getattr(credentials, 'access_token', None): _auth.apply_credentials(credentials, headers) # MIMENonMultipart adds its own Content-Type header.