pax_global_header 0000666 0000000 0000000 00000000064 13006227557 0014521 g ustar 00root root 0000000 0000000 52 comment=f19307d2079e3c3854cac887f059655a66c49896 google-api-python-client-1.5.5/ 0000775 0000000 0000000 00000000000 13006227557 0016347 5 ustar 00root root 0000000 0000000 google-api-python-client-1.5.5/.coveragerc 0000664 0000000 0000000 00000000223 13006227557 0020465 0 ustar 00root root 0000000 0000000 [report] omit = */samples/* exclude_lines = # Re-enable the standard pragma pragma: NO COVER # Ignore debug-only repr def __repr__ google-api-python-client-1.5.5/.github/ 0000775 0000000 0000000 00000000000 13006227557 0017707 5 ustar 00root root 0000000 0000000 google-api-python-client-1.5.5/.github/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000000550 13006227557 0022414 0 ustar 00root root 0000000 0000000 **Heads up!** We appreciate any bug reports or other contributions, but please note that this issue tracker is only for this client library. We do not maintain the APIs that this client library talks to. If you have an issue or questions with how to use a particular API, you may be better off posting on Stackoverflow under the `google-api` tag. Thank you! google-api-python-client-1.5.5/.gitignore 0000664 0000000 0000000 00000000227 13006227557 0020340 0 ustar 00root root 0000000 0000000 # Build artifacts *.py[cod] google_api_python_client.egg-info/ build/ dist/ # Test files .tox/ # Coverage files .coverage coverage.xml nosetests.xml google-api-python-client-1.5.5/.gitmodules 0000664 0000000 0000000 00000000000 13006227557 0020512 0 ustar 00root root 0000000 0000000 google-api-python-client-1.5.5/.hgignore 0000664 0000000 0000000 00000000436 13006227557 0020155 0 ustar 00root root 0000000 0000000 syntax: glob *.pyc *.pyc-2.4 *.dat .*.swp */.git/* */.cache/* .gitignore .tox samples/buzz/*.dat samples/moderator/*.dat htmlcov/* .coverage database.sqlite3 build/* googlecode_upload.py google_api_python_client.egg-info/* dist/* snapshot/* MANIFEST .project .pydevproject .settings/* google-api-python-client-1.5.5/.travis.yml 0000664 0000000 0000000 00000000415 13006227557 0020460 0 ustar 00root root 0000000 0000000 language: python python: 2.7 sudo: false cache: pip env: matrix: - TOX_ENV=py26 - TOX_ENV=py27 - TOX_ENV=py33 - TOX_ENV=py34 install: - pip install tox - pip install coveralls script: - tox -e $TOX_ENV after_success: coveralls notifications: email: false google-api-python-client-1.5.5/CHANGELOG 0000664 0000000 0000000 00000023161 13006227557 0017564 0 ustar 00root root 0000000 0000000 v1.5.5 Version 1.5.5 Bugfix release - Allow explicit MIME type specification with media_mime_type keyword argument. - Fix unprintable representation of BatchError with default constructor. (#165) - Refresh all discovery docs, not just the preferred ones. (#298) - Update minimum httplib2 dependency to >=0.9.2. v1.5.4 Version 1.5.4 Bugfix release - Properly handle errors when the API returns a mapping or sequence. (#289) - Upgrade to unified uritemplate 3.0.0. (#293) - Allow oauth2client 4.0.0, with the caveat that file-based discovery caching is disabled. v1.5.3 Version 1.5.3 Bugfix release - Fixed import error with oauth2client >= 3.0.0. (#270) v1.5.2 Version 1.5.2 Bugfix release - Allow using oauth2client >= 1.5.0, < 4.0.0. (#265) - Fix project_id argument description. (#257) - Retry chunk uploaded on rate limit exceeded errors. (#255) - Obtain access token if necessary in BatchHttpRequest.execute(). (#232) - Warn when running tests using HttpMock without having a cache. (#261) v1.5.1 Version 1.5.1 Bugfix release - Allow using versions of oauth2client < 2.0.0. (#197) - Check both current and new API discovery URL. (#202) - Retry http requests on connection errors and timeouts. (#218) - Retry http requests on rate limit responses. (#201) - Import guards for ssl (for Google App Engine). (#220) - Use named loggers instead of the root logger. (#206) - New search console example. (#212) v1.5.0 Version 1.5.0 Release to support oauth2client >= 2.0.0. - Fix file stream recognition in Python 3 (#141) - Fix non-resumable binary uploads in Python 3 (#147) - Default to 'octet-stream' if mimetype detection fails (#157) - Handle SSL errors with retries (#160) - Fix incompatibility with oauth2client v2.0.0 (#182) v1.4.2 Version 1.4.2 Add automatic caching for the discovery docs. v1.4.1 Version 1.4.1 Add the googleapiclient.discovery.Resource.new_batch_http_request method. v1.4.0 Version 1.4.0 Python 3 support. v1.3.2 Version 1.3.2 Small bugfix release. - Fix an infinite loop for downloading small files. - Fix a unicode error in error encoding. - Better handling of `content-length` in media requests. - Add support for methodPath entries containing colon. v1.3.1 Version 1.3.1 Quick release for a fix around aliasing in v1.3. v1.3 Version 1.3 Add support for the Google Application Default Credentials. Require python 2.6 as a minimum version. Update several API samples. Finish splitting out oauth2client repo and update tests. Various doc cleanup and bugfixes. Two important notes: * We've added `googleapiclient` as the primary suggested import name, and kept `apiclient` as an alias, in order to have a more appropriate import name. At some point, we will remove `apiclient` as an alias. * Due to an issue around in-place upgrades for Python packages, it's not possible to do an upgrade from version 1.2 to 1.3. Instead, setup.py attempts to detect this and prevents it. Simply remove the previous version and reinstall to fix this. v1.2 Version 1.2 The use of the gflags library is now deprecated, and is no longer a dependency. If you are still using the oauth2client.tools.run() function then include gflags as a dependency of your application or switch to oauth2client.tools.run_flow. Samples have been updated to use the new apiclient.sample_tools, and no longer use gflags. Added support for the experimental Object Change Notification, as found in the Cloud Storage API. The oauth2client App Engine decorators are now threadsafe. - Use the following redirects feature of httplib2 where it returns the ultimate URL after a series of redirects to avoid multiple hops for every resumable media upload request. - Updated AdSense Management API samples to V1.3 - Add option to automatically retry requests. - Ability to list registered keys in multistore_file. - User-agent must contain (gzip). - The 'method' parameter for httplib2 is not positional. This would cause spurious warnings in the logging. - Making OAuth2Decorator more extensible. Fixes Issue 256. - Update AdExchange Buyer API examples to version v1.2. v1.1 Version 1.1 Add PEM support to SignedJWTAssertionCredentials (used to only support PKCS12 formatted keys). Note that if you use PEM formatted keys you can use PyCrypto 2.6 or later instead of OpenSSL. Allow deserialized discovery docs to be passed to build_from_document(). - Make ResumableUploadError derive from HttpError. - Many changes to move all the closures in apiclient.discovery into real - classes and objects. - Make from_json behavior inheritable. - Expose the full token response in OAuth2Client and OAuth2Decorator. - Handle reasons that are None. - Added support for NDB based storing of oauth2client objects. - Update grant_type for AssertionCredentials. - Adding a .revoke() to Credentials. Closes issue 98. - Modify oauth2client.multistore_file to store and retrieve credentials using an arbitrary key. - Don't accept 403 challenges by default for auth challenges. - Set httplib2.RETRIES to 1. - Consolidate handling of scopes. - Upgrade to httplib2 version 0.8. - Allow setting the response_type in OAuth2WebServerFlow. - Ensure that dataWrapper feature is checked before using the 'data' value. - HMAC verification does not use a constant time algorithm. v1.0 Version 1.0 - Changes to the code for running tests and building releases. v1.0c3 Version 1.0 Release Candidate 3 - In samples and oauth2 decorator, escape untrusted content before displaying it. - Do not allow credentials files to be symlinks. - Add XSRF protection to oauth2decorator callback 'state'. - Handle uploading chunked media by stream. - Handle passing streams directly to httplib2. - Add support for Google Compute Engine service accounts. - Flows no longer need to be saved between uses. - Change GET to POST if URI is too long. Fixes issue #96. - Add a keyring based Storage. - More robust picking up JSON error responses. - Make batch errors align with normal errors. - Add a Google Compute sample. - Token refresh to work with 'old' GData API - Loading of client_secrets JSON file backed by a cache. - Switch to new discovery path parameters. - Add support for additionalProperties when printing schema'd objects. - Fix media upload parameter names. Reviewed in http://codereview.appspot.com/6374062/ - oauth2client support for URL-encoded format of exchange token response (e.g. Facebook) - Build cleaner and easier to read docs for dynamic surfaces. v1.0c2 Version 1.0 Release Candidate 2 - Parameter values of None should be treated as missing. Fixes issue #144. - Distribute the samples separately from the library source. Fixes issue #155. - Move all remaining samples over to client_secrets.json. Fixes issue #156. - Make locked_file.py understand win32file primitives for better awesomeness. v1.0c1 Version 1.0 Release Candidate 1 - Documentation for the library has switched to epydoc: http://google-api-python-client.googlecode.com/hg/docs/epy/index.html - Many improvements for media support: * Added media download support, including resumable downloads. * Better handling of streams that report their size as 0. * Update Media Upload to include io.Base and also fix some bugs. - OAuth bug fixes and improvements. * Remove OAuth 1.0 support. * Added credentials_from_code and credentials_from_clientsecrets_and_code. * Make oauth2client support Windows-friendly locking. * Fix bug in StorageByKeyName. * Fix None handling in Django fields. Reviewed in http://codereview.appspot.com/6298084/. Fixes issue #128. - Add epydoc generated docs. Reviewed in http://codereview.appspot.com/6305043/ - Move to PEP386 compliant version numbers. - New and updated samples * Ad Exchange Buyer API v1 code samples. * Automatically generate Samples wiki page from README files. * Update Google Prediction samples. * Add a Tasks sample that demonstrates Service accounts. * new analytics api samples. Reviewed here: http://codereview.appspot.com/5494058/ - Convert all inline samples to the Farm API for consistency. v1.0beta8 - Updated meda upload support. - Many fixes for batch requests. - Better handling for requests that don't require a body. - Fix issues with Google App Engine Python 2.7 runtime. - Better support for proxies. - All Storages now have a .delete() method. - Important changes which might break your code: * apiclient.anyjson has moved to oauth2client.anyjson. * Some calls, for example, taskqueue().lease() used to require a parameter named body. In this new release only methods that really need to send a body require a body parameter, and so you may get errors about an unknown 'body' parameter in your call. The solution is to remove the unneeded body={} parameter. v1.0beta7 - Support for batch requests. http://code.google.com/p/google-api-python-client/wiki/Batch - Support for media upload. http://code.google.com/p/google-api-python-client/wiki/MediaUpload - Better handling for APIs that return something other than JSON. - Major cleanup and consolidation of the samples. - Bug fixes and other enhancements: 72 Defect Appengine OAuth2Decorator: Convert redirect address to string 22 Defect Better error handling for unknown service name or version 48 Defect StorageByKeyName().get() has side effects 50 Defect Need sample client code for Admin Audit API 28 Defect better comments for app engine sample Nov 9 63 Enhancement Let OAuth2Decorator take a list of scope google-api-python-client-1.5.5/LICENSE 0000664 0000000 0000000 00000001377 13006227557 0017364 0 ustar 00root root 0000000 0000000 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. Dependent Modules ================= This code has the following dependencies above and beyond the Python standard library: uritemplates - Apache License 2.0 httplib2 - MIT License google-api-python-client-1.5.5/MANIFEST.in 0000664 0000000 0000000 00000000170 13006227557 0020103 0 ustar 00root root 0000000 0000000 recursive-include apiclient *.json *.py include CHANGELOG include LICENSE include README include FAQ include setpath.sh google-api-python-client-1.5.5/Makefile 0000664 0000000 0000000 00000002374 13006227557 0020015 0 ustar 00root root 0000000 0000000 pep8: find googleapiclient samples -name "*.py" | xargs pep8 --ignore=E111,E202 APP_ENGINE_PATH=../google_appengine test: tox .PHONY: coverage coverage: coverage erase find tests -name "test_*.py" | xargs --max-args=1 coverage run -a runtests.py coverage report coverage html .PHONY: docs docs: cd docs; ./build mkdir -p docs/dyn python describe.py .PHONY: wiki wiki: python samples-index.py > ../google-api-python-client.wiki/SampleApps.wiki .PHONY: prerelease prerelease: -rm -rf dist/ -sudo rm -rf dist/ -rm -rf snapshot/ -sudo rm -rf snapshot/ python expandsymlinks.py cd snapshot; python setup.py clean cd snapshot; python setup.py sdist --formats=gztar,zip bdist_wheel --universal cd snapshot; tar czf google-api-python-client-samples-$(shell python setup.py --version).tar.gz samples cd snapshot; zip -r google-api-python-client-samples-$(shell python setup.py --version).zip samples .PHONY: release release: prerelease @echo "This target will upload a new release to PyPi and code.google.com hosting." @echo "Are you sure you want to proceed? (yes/no)" @read yn; if [ yes -ne $(yn) ]; then exit 1; fi @echo "Here we go..." cd snapshot; python setup.py sdist --formats=gztar,zip bdist_wheel --universal cd snapshot; twine upload dist/* google-api-python-client-1.5.5/README.md 0000664 0000000 0000000 00000003143 13006227557 0017627 0 ustar 00root root 0000000 0000000 # About 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. # Installation To install, simply use `pip` or `easy_install`: ```bash $ pip install --upgrade google-api-python-client ``` or ```bash $ easy_install --upgrade google-api-python-client ``` 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.6 or 2.7 are fully supported. Python 3.3+ is also now supported! However, this library has not yet been used as thoroughly with Python 3, so we'd recommend testing before deploying with Python 3 in production. # Third Party Libraries and Dependencies The following libraries will be installed when you install the client library: * [httplib2](https://github.com/httplib2/httplib2) * [uritemplate](https://github.com/sigmavirus24/uritemplate) For development you will also need the following libraries: * [WebTest](http://pythonpaste.org/webtest/) * [pycrypto](https://pypi.python.org/pypi/pycrypto) * [pyopenssl](https://pypi.python.org/pypi/pyOpenSSL) # Contributing Please see the [contributing page](http://google.github.io/google-api-python-client/contributing.html) for more information. In particular, we love pull requests - but please make sure to sign the contributor license agreement. google-api-python-client-1.5.5/apiclient/ 0000775 0000000 0000000 00000000000 13006227557 0020317 5 ustar 00root root 0000000 0000000 google-api-python-client-1.5.5/apiclient/__init__.py 0000664 0000000 0000000 00000002221 13006227557 0022425 0 ustar 00root root 0000000 0000000 """Retain apiclient as an alias for googleapiclient.""" from six import iteritems import googleapiclient try: import oauth2client except ImportError: raise RuntimeError( 'Previous version of google-api-python-client detected; due to a ' 'packaging issue, we cannot perform an in-place upgrade. To repair, ' 'remove and reinstall this package, along with oauth2client and ' 'uritemplate. One can do this with pip via\n' ' pip install -I google-api-python-client' ) from googleapiclient import channel from googleapiclient import discovery from googleapiclient import errors from googleapiclient import http from googleapiclient import mimeparse from googleapiclient import model from googleapiclient import sample_tools from googleapiclient import schema __version__ = googleapiclient.__version__ _SUBMODULES = { 'channel': channel, 'discovery': discovery, 'errors': errors, 'http': http, 'mimeparse': mimeparse, 'model': model, 'sample_tools': sample_tools, 'schema': schema, } import sys for module_name, module in iteritems(_SUBMODULES): sys.modules['apiclient.%s' % module_name] = module google-api-python-client-1.5.5/describe.py 0000775 0000000 0000000 00000023461 13006227557 0020512 0 ustar 00root root 0000000 0000000 #!/usr/bin/python # # 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. """Create documentation for generate API surfaces. Command-line tool that creates documentation for all APIs listed in discovery. The documentation is generated from a combination of the discovery document and the generated API surface itself. """ __author__ = 'jcgregorio@google.com (Joe Gregorio)' import argparse import json import os import re import string import sys from googleapiclient.discovery import DISCOVERY_URI from googleapiclient.discovery import build from googleapiclient.discovery import build_from_document from googleapiclient.discovery import UnknownApiNameOrVersion import httplib2 import uritemplate CSS = """ """ METHOD_TEMPLATE = """
$name($params)
$doc
Returns the $name Resource.
""" METHOD_LINK = """$firstline
""" BASE = 'docs/dyn' DIRECTORY_URI = 'https://www.googleapis.com/discovery/v1/apis' parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--discovery_uri_template', default=DISCOVERY_URI, help='URI Template for discovery.') parser.add_argument('--discovery_uri', default='', help=('URI of discovery document. If supplied then only ' 'this API will be documented.')) parser.add_argument('--directory_uri', default=DIRECTORY_URI, help=('URI of directory document. Unused if --discovery_uri' ' is supplied.')) parser.add_argument('--dest', default=BASE, help='Directory name to write documents into.') def safe_version(version): """Create a safe version of the verion string. Needed so that we can distinguish between versions and sub-collections in URIs. I.e. we don't want adsense_v1.1 to refer to the '1' collection in the v1 version of the adsense api. Args: version: string, The version string. Returns: The string with '.' replaced with '_'. """ return version.replace('.', '_') def unsafe_version(version): """Undoes what safe_version() does. See safe_version() for the details. Args: version: string, The safe version string. Returns: The string with '_' replaced with '.'. """ return version.replace('_', '.') def method_params(doc): """Document the parameters of a method. Args: doc: string, The method's docstring. Returns: The method signature as a string. """ doclines = doc.splitlines() if 'Args:' in doclines: begin = doclines.index('Args:') if 'Returns:' in doclines[begin+1:]: end = doclines.index('Returns:', begin) args = doclines[begin+1: end] else: args = doclines[begin+1:] parameters = [] for line in args: m = re.search('^\s+([a-zA-Z0-9_]+): (.*)', line) if m is None: continue pname = m.group(1) desc = m.group(2) if '(required)' not in desc: pname = pname + '=None' parameters.append(pname) parameters = ', '.join(parameters) else: parameters = '' return parameters def method(name, doc): """Documents an individual method. Args: name: string, Name of the method. doc: string, The methods docstring. """ params = method_params(doc) return string.Template(METHOD_TEMPLATE).substitute( name=name, params=params, doc=doc) def breadcrumbs(path, root_discovery): """Create the breadcrumb trail to this page of documentation. Args: path: string, Dot separated name of the resource. root_discovery: Deserialized discovery document. Returns: HTML with links to each of the parent resources of this resource. """ parts = path.split('.') crumbs = [] accumulated = [] for i, p in enumerate(parts): prefix = '.'.join(accumulated) # The first time through prefix will be [], so we avoid adding in a # superfluous '.' to prefix. if prefix: prefix += '.' display = p if i == 0: display = root_discovery.get('title', display) crumbs.append('%s' % (prefix + p, display)) accumulated.append(p) return ' . '.join(crumbs) def document_collection(resource, path, root_discovery, discovery, css=CSS): """Document a single collection in an API. Args: resource: Collection or service being documented. path: string, Dot separated name of the resource. root_discovery: Deserialized discovery document. discovery: Deserialized discovery document, but just the portion that describes the resource. css: string, The CSS to include in the generated file. """ collections = [] methods = [] resource_name = path.split('.')[-2] html = [ '', css, 'Returns AMP URL(s) and equivalent
batchGet(body, x__xgafv=None)
Returns AMP URL(s) and equivalent [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format). Args: body: object, The request body. (required) The object takes the form of: { # AMP URL request for a batch of URLs. "lookupStrategy": "A String", # The lookup_strategy being requested. "urls": [ # List of URLs to look up for the paired AMP URLs. # The URLs are case-sensitive. Up to 50 URLs per lookup # (see [Usage Limits](/amp/cache/reference/limits)). "A String", ], } x__xgafv: string, V1 error format. Allowed values 1 - v1 error format 2 - v2 error format Returns: An object of the form: { # Batch AMP URL response. "ampUrls": [ # For each URL in BatchAmpUrlsRequest, the URL response. The response might # not be in the same order as URLs in the batch request. # If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated # only once. { # AMP URL response for a requested URL. "ampUrl": "A String", # The AMP URL pointing to the publisher's web server. "cdnAmpUrl": "A String", # The [AMP Cache URL](/amp/cache/overview#amp-cache-url-format) pointing to # the cached document in the Google AMP Cache. "originalUrl": "A String", # The original non-AMP URL. }, ], "urlErrors": [ # The errors for requested URLs that have no AMP URL. { # AMP URL Error resource for a requested URL that couldn't be found. "errorCode": "A String", # The error code of an API call. "errorMessage": "A String", # An optional descriptive error message. "originalUrl": "A String", # The original non-AMP URL. }, ], }