mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-29 10:21:35 +00:00
Google API Client 1.7.3
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
The classes implement a command pattern, with every
|
||||
object supporting an execute() method that does the
|
||||
actuall HTTP request.
|
||||
actual HTTP request.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
import six
|
||||
@@ -55,12 +55,7 @@ from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
from email.parser import FeedParser
|
||||
|
||||
# Oauth2client < 3 has the positional helper in 'util', >= 3 has it
|
||||
# in '_helpers'.
|
||||
try:
|
||||
from oauth2client import util
|
||||
except ImportError:
|
||||
from oauth2client import _helpers as util
|
||||
from googleapiclient import _helpers as util
|
||||
|
||||
from googleapiclient import _auth
|
||||
from googleapiclient.errors import BatchError
|
||||
@@ -82,6 +77,8 @@ _TOO_MANY_REQUESTS = 429
|
||||
|
||||
DEFAULT_HTTP_TIMEOUT_SEC = 60
|
||||
|
||||
_LEGACY_BATCH_URI = 'https://www.googleapis.com/batch'
|
||||
|
||||
|
||||
def _should_retry_response(resp_status, content):
|
||||
"""Determines whether a response should be retried.
|
||||
@@ -166,10 +163,14 @@ def _retry_request(http, num_retries, req_type, sleep, rand, uri, method, *args,
|
||||
# Retry on SSL errors and socket timeout errors.
|
||||
except _ssl_SSLError as ssl_error:
|
||||
exception = ssl_error
|
||||
except socket.timeout as socket_timeout:
|
||||
# It's important that this be before socket.error as it's a subclass
|
||||
# socket.timeout has no errorcode
|
||||
exception = socket_timeout
|
||||
except socket.error as socket_error:
|
||||
# errno's contents differ by platform, so we have to match by name.
|
||||
if socket.errno.errorcode.get(socket_error.errno) not in (
|
||||
'WSAETIMEDOUT', 'ETIMEDOUT', 'EPIPE', 'ECONNABORTED', ):
|
||||
if socket.errno.errorcode.get(socket_error.errno) not in {
|
||||
'WSAETIMEDOUT', 'ETIMEDOUT', 'EPIPE', 'ECONNABORTED'}:
|
||||
raise
|
||||
exception = socket_error
|
||||
|
||||
@@ -1086,7 +1087,17 @@ class BatchHttpRequest(object):
|
||||
batch_uri: string, URI to send batch requests to.
|
||||
"""
|
||||
if batch_uri is None:
|
||||
batch_uri = 'https://www.googleapis.com/batch'
|
||||
batch_uri = _LEGACY_BATCH_URI
|
||||
|
||||
if batch_uri == _LEGACY_BATCH_URI:
|
||||
LOGGER.warn(
|
||||
"You have constructed a BatchHttpRequest using the legacy batch "
|
||||
"endpoint %s. This endpoint will be turned down on March 25, 2019. "
|
||||
"Please provide the API-specific endpoint or use "
|
||||
"service.new_batch_http_request(). For more details see "
|
||||
"https://developers.googleblog.com/2018/03/discontinuing-support-for-json-rpc-and.html"
|
||||
"and https://developers.google.com/api-client-library/python/guide/batch.",
|
||||
_LEGACY_BATCH_URI)
|
||||
self._batch_uri = batch_uri
|
||||
|
||||
# Global callback to be called for each individual response in the batch.
|
||||
@@ -1279,7 +1290,7 @@ class BatchHttpRequest(object):
|
||||
from the server. The default behavior is to have the library generate it's
|
||||
own unique id. If the caller passes in a request_id then they must ensure
|
||||
uniqueness for each request_id, and if they are not an exception is
|
||||
raised. Callers should either supply all request_ids or nevery supply a
|
||||
raised. Callers should either supply all request_ids or never supply a
|
||||
request id, to avoid such an error.
|
||||
|
||||
Args:
|
||||
|
||||
Reference in New Issue
Block a user