Hello community,

here is the log from the commit of package python-google-api-python-client for 
openSUSE:Factory checked in at 2019-03-18 10:38:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-google-api-python-client (Old)
 and      /work/SRC/openSUSE:Factory/.python-google-api-python-client.new.28833 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-google-api-python-client"

Mon Mar 18 10:38:44 2019 rev:9 rq:685321 version:1.7.8

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-google-api-python-client/python-google-api-python-client.changes
  2018-12-19 13:53:45.134924957 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-google-api-python-client.new.28833/python-google-api-python-client.changes
       2019-03-18 10:38:49.439474632 +0100
@@ -1,0 +2,9 @@
+Thu Mar 14 16:26:11 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 1.7.8:
+  * bunch of small bugfixes
+  * python2 exec prints warning now about deprecation
+- Remove hidePythonDeps.patch does not make sense
+- Add back unittest2 dep, upstream hardcoded it
+
+-------------------------------------------------------------------

Old:
----
  google-api-python-client-1.7.4.tar.gz
  hidePythonDeps.patch

New:
----
  google-api-python-client-1.7.8.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-google-api-python-client.spec ++++++
--- /var/tmp/diff_new_pack.x97I8p/_old  2019-03-18 10:38:50.887473395 +0100
+++ /var/tmp/diff_new_pack.x97I8p/_new  2019-03-18 10:38:50.931473358 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-google-api-python-client
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,43 +16,36 @@
 #
 
 
-# Test scripts not included in source archive
-# https://github.com/google/google-api-python-client/issues/513
-%bcond_with test
-
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-google-api-python-client
-Version:        1.7.4
+Version:        1.7.8
 Release:        0
 Summary:        Google APIs Python Client
 License:        Apache-2.0
 Group:          Development/Languages/Python
-Url:            https://github.com/google/google-api-python-client
+URL:            https://github.com/google/google-api-python-client
 Source:         
https://files.pythonhosted.org/packages/source/g/google-api-python-client/google-api-python-client-%{version}.tar.gz
-Patch0:         hidePythonDeps.patch
+BuildRequires:  %{python_module google-auth >= 1.4.1}
+BuildRequires:  %{python_module google-auth-httplib2 >= 0.0.3}
 BuildRequires:  %{python_module httplib2 >= 0.9.2}
-BuildRequires:  %{python_module oauth2client >= 1.5.0}
+BuildRequires:  %{python_module mock}
+BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  %{python_module six >= 1.6.1}
+BuildRequires:  %{python_module unittest2}
 BuildRequires:  %{python_module uritemplate  >= 3.0.0}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
-%if %{with test}
-# Test requirements
-BuildRequires:  %{python_module nose}
-# Python 2 test requirements
-BuildRequires:  python-mock
-%endif
+Requires:       python-google-auth >= 1.4.1
+Requires:       python-google-auth-httplib2 >= 0.0.3
 Requires:       python-httplib2 >= 0.9.2
-Requires:       python-oauth2client >= 1.5.0
 Requires:       python-six >= 1.6.1
 Requires:       python-uritemplate  >= 3.0.0
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildArch:      noarch
 # Package renamed in SLE 12, do not remove Provides, Obsolete directives
 # until after SLE 12 EOL
 Provides:       google-api-python-client = %{version}
 Obsoletes:      google-api-python-client < %{version}
+BuildArch:      noarch
 %python_subpackages
 
 %description
@@ -60,7 +53,6 @@
 
 %prep
 %setup -q -n google-api-python-client-%{version}
-%patch0
 
 %build
 %python_build
@@ -69,13 +61,10 @@
 %python_install
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
-%if %{with test}
 %check
-%python_expand nosetests-%{$python_bin_suffix}
-%endif
+%pytest
 
 %files %{python_files}
-%defattr(-,root,root,-)
 %doc CHANGELOG
 %license LICENSE
 %{python_sitelib}/*

++++++ google-api-python-client-1.7.4.tar.gz -> 
google-api-python-client-1.7.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-python-client-1.7.4/CHANGELOG 
new/google-api-python-client-1.7.8/CHANGELOG
--- old/google-api-python-client-1.7.4/CHANGELOG        2018-07-11 
21:37:44.000000000 +0200
+++ new/google-api-python-client-1.7.8/CHANGELOG        2019-01-28 
23:25:02.000000000 +0100
@@ -1,6 +1,40 @@
+v1.7.8
+  Version 1.7.8
+
+  Bugfix release
+  - Convert '$' in method name to '_' 
([#616](https://github.com/googleapis/google-api-python-client/pull/616))
+  - Alias unitest2 import as unittest in test__auth.py 
([#613](https://github.com/googleapis/google-api-python-client/pull/613))
+
+v1.7.7
+  Version 1.7.7
+
+    Bugfix release
+    - Change xrange to range 
([#601](https://github.com/google/google-api-python-client/pull/601))
+    - Typo in http.py exception message. 
([#602](https://github.com/google/google-api-python-client/pull/602))
+
+    - Announce deprecation of Python 2.7 
([#603](https://github.com/google/google-api-python-client/pull/603))
+    - Updates documentation for stopping channel subscriptions 
([#598](https://github.com/google/google-api-python-client/pull/598))
+    - Adding example for searchAppearance 
([#414](https://github.com/google/google-api-python-client/pull/414))
+
+    - Add badges 
([#455](https://github.com/google/google-api-python-client/pull/455))
+
+v1.7.6
+  Version 1.7.6
+
+  Bugfix release
+
+  - Add client-side limit for batch requests (#585)
+
+v1.7.5
+  Version 1.7.5
+
+  Bugfix release
+
+  - Fix the client to respect the passed in developerKey and credentials
+
 v1.7.4
   Version 1.7.4
- 
+
   Bugfix release
 
   - Catch ServerNotFoundError to retry the request (#532)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-python-client-1.7.4/PKG-INFO 
new/google-api-python-client-1.7.8/PKG-INFO
--- old/google-api-python-client-1.7.4/PKG-INFO 2018-07-11 21:51:57.000000000 
+0200
+++ new/google-api-python-client-1.7.8/PKG-INFO 2019-01-28 23:25:34.000000000 
+0100
@@ -1,10 +1,9 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
 Name: google-api-python-client
-Version: 1.7.4
+Version: 1.7.8
 Summary: Google API Client Library for Python
 Home-page: http://github.com/google/google-api-python-client/
 Author: Google Inc.
-Author-email: UNKNOWN
 License: Apache 2.0
 Description: The Google API Client for Python is a client library for
         accessing the Plus, Moderator, and many other Google APIs.
@@ -13,12 +12,13 @@
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Operating System :: OS Independent
 Classifier: Topic :: Internet :: WWW/HTTP
+Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-python-client-1.7.4/README.md 
new/google-api-python-client-1.7.8/README.md
--- old/google-api-python-client-1.7.4/README.md        2018-07-11 
21:28:47.000000000 +0200
+++ new/google-api-python-client-1.7.8/README.md        2019-01-28 
23:25:02.000000000 +0100
@@ -1,6 +1,8 @@
 # Google API Client
 
-This is the Python client library for Google's discovery based APIs. To get 
started, please see the [full documentation for this 
library](http://google.github.io/google-api-python-client). Additionally, 
[dynamically generated 
documentation](http://api-python-client-doc.appspot.com/) is available for all 
of the APIs supported by this library.
+[![PyPI 
version](https://badge.fury.io/py/google-api-python-client.svg)](https://badge.fury.io/py/google-api-python-client)
+
+This is the Python client library for Google's discovery based APIs. To get 
started, please see the [full documentation for this 
library](https://developers.google.com/api-client-library/python/). 
Additionally, [dynamically generated 
documentation](http://google.github.io/google-api-python-client/docs/epy/index.html)
 is available for all of the APIs supported by this library.
 
 These client libraries are officially supported by Google.  However, the 
libraries are considered complete and are in maintenance mode. This means that 
we will address critical bugs and security issues but will not add any new 
features.
 
@@ -21,8 +23,11 @@
 
 See the [Developers 
Guide](https://developers.google.com/api-client-library/python/start/get_started)
 for more detailed instructions and additional documentation.
 
-# Python Version
-Python 2.7, 3.4, 3.5, and 3.6 are fully supported and tested. This library may 
work on later versions of 3, but we do not currently run tests against those 
versions.
+# Supported Python Versions
+Python 3.4, 3.5, 3.6 and 3.7 are fully supported and tested. This library may 
work on later versions of 3, but we do not currently run tests against those 
versions
+
+# Deprecated Python Versions
+Python == 2.7
 
 # Third Party Libraries and Dependencies
 The following libraries will be installed when you install the client library:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-python-client-1.7.4/google_api_python_client.egg-info/PKG-INFO 
new/google-api-python-client-1.7.8/google_api_python_client.egg-info/PKG-INFO
--- 
old/google-api-python-client-1.7.4/google_api_python_client.egg-info/PKG-INFO   
    2018-07-11 21:51:56.000000000 +0200
+++ 
new/google-api-python-client-1.7.8/google_api_python_client.egg-info/PKG-INFO   
    2019-01-28 23:25:34.000000000 +0100
@@ -1,10 +1,9 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
 Name: google-api-python-client
-Version: 1.7.4
+Version: 1.7.8
 Summary: Google API Client Library for Python
 Home-page: http://github.com/google/google-api-python-client/
 Author: Google Inc.
-Author-email: UNKNOWN
 License: Apache 2.0
 Description: The Google API Client for Python is a client library for
         accessing the Plus, Moderator, and many other Google APIs.
@@ -13,12 +12,13 @@
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Operating System :: OS Independent
 Classifier: Topic :: Internet :: WWW/HTTP
+Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-python-client-1.7.4/googleapiclient/__init__.py 
new/google-api-python-client-1.7.8/googleapiclient/__init__.py
--- old/google-api-python-client-1.7.4/googleapiclient/__init__.py      
2018-07-11 21:35:29.000000000 +0200
+++ new/google-api-python-client-1.7.8/googleapiclient/__init__.py      
2019-01-28 23:25:02.000000000 +0100
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__version__ = "1.7.4"
+__version__ = "1.7.8"
 
 # Set default logging handler to avoid "No handler found" warnings.
 import logging
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-python-client-1.7.4/googleapiclient/channel.py 
new/google-api-python-client-1.7.8/googleapiclient/channel.py
--- old/google-api-python-client-1.7.4/googleapiclient/channel.py       
2018-07-11 21:28:48.000000000 +0200
+++ new/google-api-python-client-1.7.8/googleapiclient/channel.py       
2019-01-28 23:25:02.000000000 +0100
@@ -1,3 +1,17 @@
+# Copyright 2014 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 """Channel notifications support.
 
 Classes and functions to support channel subscriptions and notifications
@@ -53,7 +67,7 @@
 
 Example of unsubscribing.
 
-  service.channels().stop(channel.body())
+  service.channels().stop(channel.body()).execute()
 """
 from __future__ import absolute_import
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-python-client-1.7.4/googleapiclient/discovery.py 
new/google-api-python-client-1.7.8/googleapiclient/discovery.py
--- old/google-api-python-client-1.7.4/googleapiclient/discovery.py     
2018-07-11 21:28:48.000000000 +0200
+++ new/google-api-python-client-1.7.8/googleapiclient/discovery.py     
2019-01-28 23:25:02.000000000 +0100
@@ -126,14 +126,16 @@
   _write_lines = BytesGenerator.write
 
 def fix_method_name(name):
-  """Fix method names to avoid reserved word conflicts.
+  """Fix method names to avoid '$' characters and reserved word conflicts.
 
   Args:
     name: string, method name.
 
   Returns:
-    The name with an '_' appended if the name is a reserved word.
+    The name with '_' appended if the name is a reserved word and '$' 
+    replaced with '_'. 
   """
+  name = name.replace('$', '_')
   if keyword.iskeyword(name) or name in RESERVED_WORDS:
     return name + '_'
   else:
@@ -219,7 +221,7 @@
 
     try:
       content = _retrieve_discovery_doc(
-        requested_url, discovery_http, cache_discovery, cache)
+        requested_url, discovery_http, cache_discovery, cache, developerKey)
       return build_from_document(content, base=discovery_url, http=http,
           developerKey=developerKey, model=model, 
requestBuilder=requestBuilder,
           credentials=credentials)
@@ -233,7 +235,8 @@
         "name: %s  version: %s" % (serviceName, version))
 
 
-def _retrieve_discovery_doc(url, http, cache_discovery, cache=None):
+def _retrieve_discovery_doc(url, http, cache_discovery, cache=None,
+                            developerKey=None):
   """Retrieves the discovery_doc from cache or the internet.
 
   Args:
@@ -264,6 +267,8 @@
   # document to avoid exceeding the quota on discovery requests.
   if 'REMOTE_ADDR' in os.environ:
     actual_url = _add_query_parameter(url, 'userIp', os.environ['REMOTE_ADDR'])
+  if developerKey:
+    actual_url = _add_query_parameter(url, 'key', developerKey)
   logger.info('URL being requested: GET %s', actual_url)
 
   resp, content = http.request(actual_url)
@@ -360,7 +365,9 @@
       # The credentials need to be scoped.
       credentials = _auth.with_scopes(credentials, scopes)
 
-      # Create an authorized http instance
+    # If credentials are provided, create an authorized http instance;
+    # otherwise, skip authentication.
+    if credentials:
       http = _auth.authorized_http(credentials)
 
     # If the service doesn't require scopes then there is no need for
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-python-client-1.7.4/googleapiclient/http.py 
new/google-api-python-client-1.7.8/googleapiclient/http.py
--- old/google-api-python-client-1.7.4/googleapiclient/http.py  2018-07-11 
21:28:48.000000000 +0200
+++ new/google-api-python-client-1.7.8/googleapiclient/http.py  2019-01-28 
23:25:02.000000000 +0100
@@ -73,6 +73,8 @@
 
 MAX_URI_LENGTH = 2048
 
+MAX_BATCH_LIMIT = 1000
+
 _TOO_MANY_REQUESTS = 429
 
 DEFAULT_HTTP_TIMEOUT_SEC = 60
@@ -647,6 +649,14 @@
     self._sleep = time.sleep
     self._rand = random.random
 
+    self._headers = {}
+    for k, v in six.iteritems(request.headers):
+      # allow users to supply custom headers by setting them on the request
+      # but strip out the ones that are set by default on requests generated by
+      # API methods like Drive's files().get(fileId=...)
+      if not k.lower() in ('accept', 'accept-encoding', 'user-agent'):
+        self._headers[k] = v
+
   @util.positional(1)
   def next_chunk(self, num_retries=0):
     """Get the next chunk of the download.
@@ -666,10 +676,9 @@
       googleapiclient.errors.HttpError if the response was not a 2xx.
       httplib2.HttpLib2Error if a transport error has occured.
     """
-    headers = {
-        'range': 'bytes=%d-%d' % (
+    headers = self._headers.copy()
+    headers['range'] = 'bytes=%d-%d' % (
             self._progress, self._progress + self._chunksize)
-        }
     http = self._request.http
 
     resp, content = _retry_request(
@@ -1171,7 +1180,10 @@
     if self._base_id is None:
       self._base_id = uuid.uuid4()
 
-    return '<%s+%s>' % (self._base_id, quote(id_))
+    # NB: we intentionally leave whitespace between base/id and '+', so RFC2822
+    # line folding works properly on Python 3; see
+    # https://github.com/google/google-api-python-client/issues/164
+    return '<%s + %s>' % (self._base_id, quote(id_))
 
   def _header_to_id(self, header):
     """Convert a Content-ID header value to an id.
@@ -1192,7 +1204,7 @@
       raise BatchError("Invalid value for Content-ID: %s" % header)
     if '+' not in header:
       raise BatchError("Invalid value for Content-ID: %s" % header)
-    base, id_ = header[1:-1].rsplit('+', 1)
+    base, id_ = header[1:-1].split(' + ', 1)
 
     return unquote(id_)
 
@@ -1302,8 +1314,8 @@
         request id, and the second is the deserialized response object. The
         third is an googleapiclient.errors.HttpError exception object if an 
HTTP error
         occurred while processing the request, or None if no errors occurred.
-      request_id: string, A unique id for the request. The id will be passed to
-        the callback with the response.
+      request_id: string, A unique id for the request. The id will be passed
+        to the callback with the response.
 
     Returns:
       None
@@ -1312,6 +1324,10 @@
       BatchError if a media request is added to a batch.
       KeyError is the request_id is not unique.
     """
+
+    if len(self._order) >= MAX_BATCH_LIMIT:
+      raise BatchError("Exceeded the maximum calls(%d) in a single batch 
request."
+                       % MAX_BATCH_LIMIT)
     if request_id is None:
       request_id = self._new_id()
     if request.resumable is not None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-python-client-1.7.4/googleapiclient/sample_tools.py 
new/google-api-python-client-1.7.8/googleapiclient/sample_tools.py
--- old/google-api-python-client-1.7.4/googleapiclient/sample_tools.py  
2018-07-11 21:28:48.000000000 +0200
+++ new/google-api-python-client-1.7.8/googleapiclient/sample_tools.py  
2018-11-20 00:06:17.000000000 +0100
@@ -28,14 +28,6 @@
 from googleapiclient import discovery
 from googleapiclient.http import build_http
 
-try:
-    from oauth2client import client
-    from oauth2client import file
-    from oauth2client import tools
-except ImportError:
-    raise ImportError('googleapiclient.sample_tools requires oauth2client. 
Please install oauth2client and try again.')
-
-
 def init(argv, name, version, doc, filename, scope=None, parents=[], 
discovery_filename=None):
   """A common initialization routine for samples.
 
@@ -60,6 +52,13 @@
     A tuple of (service, flags), where service is the service object and flags
     is the parsed command-line flags.
   """
+  try:
+      from oauth2client import client
+      from oauth2client import file
+      from oauth2client import tools
+  except ImportError:
+      raise ImportError('googleapiclient.sample_tools requires oauth2client. 
Please install oauth2client and try again.')
+
   if scope is None:
     scope = 'https://www.googleapis.com/auth/' + name
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-python-client-1.7.4/setup.py 
new/google-api-python-client-1.7.8/setup.py
--- old/google-api-python-client-1.7.4/setup.py 2018-07-11 21:34:16.000000000 
+0200
+++ new/google-api-python-client-1.7.8/setup.py 2019-01-28 23:25:02.000000000 
+0100
@@ -25,8 +25,8 @@
   print('google-api-python-client requires python version >= 2.7.',
         file=sys.stderr)
   sys.exit(1)
-if (3, 1) <= sys.version_info < (3, 3):
-  print('google-api-python-client requires python3 version >= 3.3.',
+if (3, 1) <= sys.version_info < (3, 4):
+  print('google-api-python-client requires python3 version >= 3.4.',
         file=sys.stderr)
   sys.exit(1)
 
@@ -60,6 +60,7 @@
     author="Google Inc.",
     url="http://github.com/google/google-api-python-client/";,
     install_requires=install_requires,
+    python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
     packages=packages,
     package_data={},
     license="Apache 2.0",
@@ -68,10 +69,10 @@
         'Programming Language :: Python :: 2',
         'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
         'Development Status :: 5 - Production/Stable',
         'Intended Audience :: Developers',
         'License :: OSI Approved :: Apache Software License',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-python-client-1.7.4/tests/test__auth.py 
new/google-api-python-client-1.7.8/tests/test__auth.py
--- old/google-api-python-client-1.7.4/tests/test__auth.py      2018-07-11 
21:28:48.000000000 +0200
+++ new/google-api-python-client-1.7.8/tests/test__auth.py      2019-01-28 
23:25:02.000000000 +0100
@@ -18,12 +18,12 @@
 import google_auth_httplib2
 import httplib2
 import oauth2client.client
-import unittest2
+import unittest2 as unittest
 
 from googleapiclient import _auth
 
 
-class TestAuthWithGoogleAuth(unittest2.TestCase):
+class TestAuthWithGoogleAuth(unittest.TestCase):
     def setUp(self):
         _auth.HAS_GOOGLE_AUTH = True
         _auth.HAS_OAUTH2CLIENT = False
@@ -77,7 +77,7 @@
         self.assertGreater(authorized_http.http.timeout, 0)
 
 
-class TestAuthWithOAuth2Client(unittest2.TestCase):
+class TestAuthWithOAuth2Client(unittest.TestCase):
     def setUp(self):
         _auth.HAS_GOOGLE_AUTH = False
         _auth.HAS_OAUTH2CLIENT = True
@@ -127,7 +127,7 @@
         self.assertGreater(http.timeout, 0)
 
 
-class TestAuthWithoutAuth(unittest2.TestCase):
+class TestAuthWithoutAuth(unittest.TestCase):
 
     def setUp(self):
         _auth.HAS_GOOGLE_AUTH = False
@@ -142,7 +142,7 @@
             print(_auth.default_credentials())
 
 
-class TestGoogleAuthWithoutHttplib2(unittest2.TestCase):
+class TestGoogleAuthWithoutHttplib2(unittest.TestCase):
     def setUp(self):
         _auth.google_auth_httplib2 = None
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-api-python-client-1.7.4/tests/test_discovery.py 
new/google-api-python-client-1.7.8/tests/test_discovery.py
--- old/google-api-python-client-1.7.4/tests/test_discovery.py  2018-07-11 
21:28:48.000000000 +0200
+++ new/google-api-python-client-1.7.8/tests/test_discovery.py  2018-11-30 
19:30:19.000000000 +0100
@@ -449,7 +449,7 @@
 
     plus = build_from_document(
       discovery, base="https://www.googleapis.com/";,
-      credentials=self.MOCK_CREDENTIALS)
+      credentials=None)
     # plus service requires Authorization
     self.assertIsInstance(plus._http, httplib2.Http)
     self.assertIsInstance(plus._http.timeout, int)
@@ -487,7 +487,7 @@
       http = HttpMockSequence([
         ({'status': '400'}, open(datafile('zoo.json'), 'rb').read()),
         ])
-      zoo = build('zoo', 'v1', http=http, developerKey='foo',
+      zoo = build('zoo', 'v1', http=http, developerKey=None,
                   discoveryServiceUrl='http://example.com')
       self.fail('Should have raised an exception.')
     except HttpError as e:
@@ -506,6 +506,19 @@
     except HttpError as e:
       self.assertEqual(e.uri, 'http://example.com')
 
+  def test_key_is_added_to_discovery_uri(self):
+    # build() will raise an HttpError on a 400, use this to pick the request 
uri
+    # out of the raised exception.
+    try:
+      http = HttpMockSequence([
+        ({'status': '400'}, open(datafile('zoo.json'), 'rb').read()),
+        ])
+      zoo = build('zoo', 'v1', http=http, developerKey='foo',
+                  discoveryServiceUrl='http://example.com')
+      self.fail('Should have raised an exception.')
+    except HttpError as e:
+      self.assertEqual(e.uri, 'http://example.com?key=foo')
+
   def test_discovery_loading_from_v2_discovery_uri(self):
       http = HttpMockSequence([
         ({'status': '404'}, 'Not found'),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-api-python-client-1.7.4/tests/test_http.py 
new/google-api-python-client-1.7.8/tests/test_http.py
--- old/google-api-python-client-1.7.4/tests/test_http.py       2018-07-11 
21:28:48.000000000 +0200
+++ new/google-api-python-client-1.7.8/tests/test_http.py       2019-01-26 
01:21:37.000000000 +0100
@@ -29,6 +29,7 @@
 from six.moves.urllib.parse import urlencode
 
 # Do not remove the httplib2 import
+import json
 import httplib2
 import logging
 import mock
@@ -456,6 +457,41 @@
     self.assertEqual(5, download._progress)
     self.assertEqual(5, download._total_size)
 
+  def test_media_io_base_download_custom_request_headers(self):
+    self.request.http = HttpMockSequence([
+      ({'status': '200',
+        'content-range': '0-2/5'}, 'echo_request_headers_as_json'),
+      ({'status': '200',
+        'content-range': '3-4/5'}, 'echo_request_headers_as_json'),
+    ])
+    self.assertEqual(True, self.request.http.follow_redirects)
+
+    self.request.headers['Cache-Control'] = 'no-store'
+
+    download = MediaIoBaseDownload(
+        fd=self.fd, request=self.request, chunksize=3)
+
+    self.assertEqual(download._headers, {'Cache-Control':'no-store'})
+
+    status, done = download.next_chunk()
+
+    result = self.fd.getvalue().decode('utf-8')
+
+    # we abuse the internals of the object we're testing, pay no attention
+    # to the actual bytes= values here; we are just asserting that the
+    # header we added to the original request is sent up to the server
+    # on each call to next_chunk
+
+    self.assertEqual(json.loads(result),
+                     {"Cache-Control": "no-store", "range": "bytes=0-3"})
+
+    download._fd = self.fd = BytesIO()
+    status, done = download.next_chunk()
+
+    result = self.fd.getvalue().decode('utf-8')
+    self.assertEqual(json.loads(result),
+                     {"Cache-Control": "no-store", "range": "bytes=51-54"})
+
   def test_media_io_base_download_handle_redirects(self):
     self.request.http = HttpMockSequence([
       ({'status': '200',
@@ -635,7 +671,7 @@
 BATCH_RESPONSE = b"""--batch_foobarbaz
 Content-Type: application/http
 Content-Transfer-Encoding: binary
-Content-ID: <randomness+1>
+Content-ID: <randomness + 1>
 
 HTTP/1.1 200 OK
 Content-Type: application/json
@@ -645,7 +681,7 @@
 --batch_foobarbaz
 Content-Type: application/http
 Content-Transfer-Encoding: binary
-Content-ID: <randomness+2>
+Content-ID: <randomness + 2>
 
 HTTP/1.1 200 OK
 Content-Type: application/json
@@ -657,7 +693,7 @@
 BATCH_ERROR_RESPONSE = b"""--batch_foobarbaz
 Content-Type: application/http
 Content-Transfer-Encoding: binary
-Content-ID: <randomness+1>
+Content-ID: <randomness + 1>
 
 HTTP/1.1 200 OK
 Content-Type: application/json
@@ -667,7 +703,7 @@
 --batch_foobarbaz
 Content-Type: application/http
 Content-Transfer-Encoding: binary
-Content-ID: <randomness+2>
+Content-ID: <randomness + 2>
 
 HTTP/1.1 403 Access Not Configured
 Content-Type: application/json
@@ -693,7 +729,7 @@
 BATCH_RESPONSE_WITH_401 = b"""--batch_foobarbaz
 Content-Type: application/http
 Content-Transfer-Encoding: binary
-Content-ID: <randomness+1>
+Content-ID: <randomness + 1>
 
 HTTP/1.1 401 Authorization Required
 Content-Type: application/json
@@ -704,7 +740,7 @@
 --batch_foobarbaz
 Content-Type: application/http
 Content-Transfer-Encoding: binary
-Content-ID: <randomness+2>
+Content-ID: <randomness + 2>
 
 HTTP/1.1 200 OK
 Content-Type: application/json
@@ -716,7 +752,7 @@
 BATCH_SINGLE_RESPONSE = b"""--batch_foobarbaz
 Content-Type: application/http
 Content-Transfer-Encoding: binary
-Content-ID: <randomness+1>
+Content-ID: <randomness + 1>
 
 HTTP/1.1 200 OK
 Content-Type: application/json
@@ -1156,6 +1192,21 @@
     batch.add(self.request1, request_id='1')
     self.assertRaises(KeyError, batch.add, self.request1, request_id='1')
 
+  def test_add_fail_for_over_limit(self):
+    from googleapiclient.http import MAX_BATCH_LIMIT
+
+    batch = BatchHttpRequest()
+    for i in range(0, MAX_BATCH_LIMIT):
+      batch.add(HttpRequest(
+        None,
+        None,
+        'https://www.googleapis.com/someapi/v1/collection/?foo=bar',
+        method='POST',
+        body='{}',
+        headers={'content-type': 'application/json'})
+      )
+    self.assertRaises(BatchError, batch.add, self.request1)
+
   def test_add_fail_for_resumable(self):
     batch = BatchHttpRequest()
 
@@ -1211,6 +1262,39 @@
       header = parts[1].splitlines()[1]
       self.assertEqual('Content-Type: application/http', header)
 
+  def test_execute_request_body_with_custom_long_request_ids(self):
+    batch = BatchHttpRequest()
+
+    batch.add(self.request1, request_id='abc'*20)
+    batch.add(self.request2, request_id='def'*20)
+    http = HttpMockSequence([
+      ({'status': '200',
+        'content-type': 'multipart/mixed; boundary="batch_foobarbaz"'},
+        'echo_request_body'),
+      ])
+    try:
+      batch.execute(http=http)
+      self.fail('Should raise exception')
+    except BatchError as e:
+      boundary, _ = e.content.split(None, 1)
+      self.assertEqual('--', boundary[:2])
+      parts = e.content.split(boundary)
+      self.assertEqual(4, len(parts))
+      self.assertEqual('', parts[0])
+      self.assertEqual('--', parts[3].rstrip())
+      for partindex, request_id in ((1, 'abc'*20), (2, 'def'*20)):
+        lines = parts[partindex].splitlines()
+        for n, line in enumerate(lines):
+          if line.startswith('Content-ID:'):
+            # assert correct header folding
+            self.assertTrue(line.endswith('+'), line)
+            header_continuation = lines[n+1]
+            self.assertEqual(
+              header_continuation,
+              ' %s>' % request_id,
+              header_continuation
+            )
+
   def test_execute_initial_refresh_oauth2(self):
     batch = BatchHttpRequest()
     callbacks = Callbacks()


Reply via email to