Skip to content

Commit bae748a

Browse files
author
Jon Wayne Parrott
authored
Warn when constructing BatchHttpRequest using the legacy batch URI (googleapis#488)
1 parent cb2ce4f commit bae748a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

googleapiclient/http.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282

8383
DEFAULT_HTTP_TIMEOUT_SEC = 60
8484

85+
_LEGACY_BATCH_URI = 'https://www.googleapis.com/batch'
86+
8587

8688
def _should_retry_response(resp_status, content):
8789
"""Determines whether a response should be retried.
@@ -1086,7 +1088,17 @@ def __init__(self, callback=None, batch_uri=None):
10861088
batch_uri: string, URI to send batch requests to.
10871089
"""
10881090
if batch_uri is None:
1089-
batch_uri = 'https://www.googleapis.com/batch'
1091+
batch_uri = _LEGACY_BATCH_URI
1092+
1093+
if batch_uri == _LEGACY_BATCH_URI:
1094+
LOGGER.warn(
1095+
"You have constructed a BatchHttpRequest using the legacy batch "
1096+
"endpoint %s. This endpoint will be turned down on March 25, 2019. "
1097+
"Please provide the API-specific endpoint or use "
1098+
"service.new_batch_http_request(). For more details see "
1099+
"https://developers.googleblog.com/2018/03/discontinuing-support-for-json-rpc-and.html"
1100+
"and https://developers.google.com/api-client-library/python/guide/batch.",
1101+
_LEGACY_BATCH_URI)
10901102
self._batch_uri = batch_uri
10911103

10921104
# Global callback to be called for each individual response in the batch.

0 commit comments

Comments
 (0)