From 504a17fa878cb57e89de73ebd48add7c67ee2ac5 Mon Sep 17 00:00:00 2001 From: Joe Gregorio Date: Fri, 7 Dec 2012 14:14:26 -0500 Subject: [PATCH] Set httplib2.RETRIES to 1. Reviewed in https://codereview.appspot.com/6906051/. --- apiclient/discovery.py | 3 +++ tests/test_discovery.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/apiclient/discovery.py b/apiclient/discovery.py index ea61919..eb179ff 100644 --- a/apiclient/discovery.py +++ b/apiclient/discovery.py @@ -59,6 +59,9 @@ from email.mime.nonmultipart import MIMENonMultipart from oauth2client.util import positional from oauth2client.anyjson import simplejson +# The client library requires a version of httplib2 that supports RETRIES. +httplib2.RETRIES = 1 + logger = logging.getLogger(__name__) URITEMPLATE = re.compile('{[^}]*}') diff --git a/tests/test_discovery.py b/tests/test_discovery.py index 180aa3c..b2ee56c 100644 --- a/tests/test_discovery.py +++ b/tests/test_discovery.py @@ -89,6 +89,12 @@ def datafile(filename): return os.path.join(DATA_DIR, filename) +class SetupHttplib2(unittest.TestCase): + def test_retries(self): + # Merely loading apiclient.discovery should set the RETRIES to 1. + self.assertEqual(1, httplib2.RETRIES) + + class Utilities(unittest.TestCase): def test_key2param(self): self.assertEqual('max_results', key2param('max-results'))