Transition apiclient from googlecode to github.
diff --git a/samples/adexchangebuyer/get_all_accounts.py b/samples/adexchangebuyer/get_all_accounts.py
index 41d2554..4be7d26 100644
--- a/samples/adexchangebuyer/get_all_accounts.py
+++ b/samples/adexchangebuyer/get_all_accounts.py
@@ -24,7 +24,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
diff --git a/samples/adexchangebuyer/get_creative.py b/samples/adexchangebuyer/get_creative.py
index e4db623..9af1a48 100644
--- a/samples/adexchangebuyer/get_creative.py
+++ b/samples/adexchangebuyer/get_creative.py
@@ -26,7 +26,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/adexchangebuyer/get_direct_deals.py b/samples/adexchangebuyer/get_direct_deals.py
index 518d1a8..a824ed6 100644
--- a/samples/adexchangebuyer/get_direct_deals.py
+++ b/samples/adexchangebuyer/get_direct_deals.py
@@ -24,7 +24,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
diff --git a/samples/adexchangebuyer/submit_creative.py b/samples/adexchangebuyer/submit_creative.py
index e968093..25531aa 100644
--- a/samples/adexchangebuyer/submit_creative.py
+++ b/samples/adexchangebuyer/submit_creative.py
@@ -26,7 +26,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/adexchangebuyer/update_account.py b/samples/adexchangebuyer/update_account.py
index 1b9c9a5..f4ea331 100644
--- a/samples/adexchangebuyer/update_account.py
+++ b/samples/adexchangebuyer/update_account.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/adexchangeseller/generate_report.py b/samples/adexchangeseller/generate_report.py
index 5ab8708..d160c37 100644
--- a/samples/adexchangeseller/generate_report.py
+++ b/samples/adexchangeseller/generate_report.py
@@ -26,7 +26,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/adexchangeseller/generate_report_with_paging.py b/samples/adexchangeseller/generate_report_with_paging.py
index 738fc02..055faa8 100644
--- a/samples/adexchangeseller/generate_report_with_paging.py
+++ b/samples/adexchangeseller/generate_report_with_paging.py
@@ -30,7 +30,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
MAX_PAGE_SIZE = 50
diff --git a/samples/adexchangeseller/get_all_ad_clients.py b/samples/adexchangeseller/get_all_ad_clients.py
index fbee719..694449b 100644
--- a/samples/adexchangeseller/get_all_ad_clients.py
+++ b/samples/adexchangeseller/get_all_ad_clients.py
@@ -23,7 +23,7 @@
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
MAX_PAGE_SIZE = 50
diff --git a/samples/adexchangeseller/get_all_ad_units.py b/samples/adexchangeseller/get_all_ad_units.py
index c439e95..41d79e0 100644
--- a/samples/adexchangeseller/get_all_ad_units.py
+++ b/samples/adexchangeseller/get_all_ad_units.py
@@ -26,7 +26,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/adexchangeseller/get_all_ad_units_for_custom_channel.py b/samples/adexchangeseller/get_all_ad_units_for_custom_channel.py
index 061c6d3..3a2d9a1 100644
--- a/samples/adexchangeseller/get_all_ad_units_for_custom_channel.py
+++ b/samples/adexchangeseller/get_all_ad_units_for_custom_channel.py
@@ -26,7 +26,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/adexchangeseller/get_all_alerts.py b/samples/adexchangeseller/get_all_alerts.py
index b1af2cf..f73595b 100644
--- a/samples/adexchangeseller/get_all_alerts.py
+++ b/samples/adexchangeseller/get_all_alerts.py
@@ -24,7 +24,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
diff --git a/samples/adexchangeseller/get_all_custom_channels.py b/samples/adexchangeseller/get_all_custom_channels.py
index ec19581..84bf43d 100644
--- a/samples/adexchangeseller/get_all_custom_channels.py
+++ b/samples/adexchangeseller/get_all_custom_channels.py
@@ -26,7 +26,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/adexchangeseller/get_all_custom_channels_for_ad_unit.py b/samples/adexchangeseller/get_all_custom_channels_for_ad_unit.py
index 421c596..8558fcf 100644
--- a/samples/adexchangeseller/get_all_custom_channels_for_ad_unit.py
+++ b/samples/adexchangeseller/get_all_custom_channels_for_ad_unit.py
@@ -27,7 +27,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/adexchangeseller/get_all_dimensions.py b/samples/adexchangeseller/get_all_dimensions.py
index f4468d6..60391d6 100644
--- a/samples/adexchangeseller/get_all_dimensions.py
+++ b/samples/adexchangeseller/get_all_dimensions.py
@@ -24,7 +24,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
diff --git a/samples/adexchangeseller/get_all_metrics.py b/samples/adexchangeseller/get_all_metrics.py
index e575724..37ee2a8 100644
--- a/samples/adexchangeseller/get_all_metrics.py
+++ b/samples/adexchangeseller/get_all_metrics.py
@@ -24,7 +24,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
diff --git a/samples/adexchangeseller/get_all_preferred_deals.py b/samples/adexchangeseller/get_all_preferred_deals.py
index 8217d47..5583598 100644
--- a/samples/adexchangeseller/get_all_preferred_deals.py
+++ b/samples/adexchangeseller/get_all_preferred_deals.py
@@ -24,7 +24,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
diff --git a/samples/adexchangeseller/get_all_saved_reports.py b/samples/adexchangeseller/get_all_saved_reports.py
index 2a1b8f9..3c6d8f3 100644
--- a/samples/adexchangeseller/get_all_saved_reports.py
+++ b/samples/adexchangeseller/get_all_saved_reports.py
@@ -24,7 +24,7 @@
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
MAX_PAGE_SIZE = 50
diff --git a/samples/adexchangeseller/get_all_url_channels.py b/samples/adexchangeseller/get_all_url_channels.py
index e7fb5aa..2061ce0 100644
--- a/samples/adexchangeseller/get_all_url_channels.py
+++ b/samples/adexchangeseller/get_all_url_channels.py
@@ -26,7 +26,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
MAX_PAGE_SIZE = 50
diff --git a/samples/analytics/core_reporting_v3_reference.py b/samples/analytics/core_reporting_v3_reference.py
index 71d7da2..0f208a5 100755
--- a/samples/analytics/core_reporting_v3_reference.py
+++ b/samples/analytics/core_reporting_v3_reference.py
@@ -62,8 +62,8 @@
import argparse
import sys
-from apiclient.errors import HttpError
-from apiclient import sample_tools
+from googleapiclient.errors import HttpError
+from googleapiclient import sample_tools
from oauth2client.client import AccessTokenRefreshError
# Declare command-line flags.
diff --git a/samples/analytics/hello_analytics_api_v3.py b/samples/analytics/hello_analytics_api_v3.py
index 915e7f8..cac3a28 100755
--- a/samples/analytics/hello_analytics_api_v3.py
+++ b/samples/analytics/hello_analytics_api_v3.py
@@ -46,8 +46,8 @@
import argparse
import sys
-from apiclient.errors import HttpError
-from apiclient import sample_tools
+from googleapiclient.errors import HttpError
+from googleapiclient import sample_tools
from oauth2client.client import AccessTokenRefreshError
diff --git a/samples/analytics/management_v3_reference.py b/samples/analytics/management_v3_reference.py
index 10ecd23..e455af7 100755
--- a/samples/analytics/management_v3_reference.py
+++ b/samples/analytics/management_v3_reference.py
@@ -56,8 +56,8 @@
import argparse
import sys
-from apiclient.errors import HttpError
-from apiclient import sample_tools
+from googleapiclient.errors import HttpError
+from googleapiclient import sample_tools
from oauth2client.client import AccessTokenRefreshError
diff --git a/samples/api-python-client-doc/main.py b/samples/api-python-client-doc/main.py
index 6a67f58..d95c612 100755
--- a/samples/api-python-client-doc/main.py
+++ b/samples/api-python-client-doc/main.py
@@ -34,8 +34,8 @@
import describe
import uritemplate
-from apiclient import discovery
-from apiclient.errors import HttpError
+from googleapiclient import discovery
+from googleapiclient.errors import HttpError
from google.appengine.api import memcache
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
diff --git a/samples/appengine/main.py b/samples/appengine/main.py
index 0255cd3..bbeacf6 100644
--- a/samples/appengine/main.py
+++ b/samples/appengine/main.py
@@ -30,7 +30,7 @@
import os
import pickle
-from apiclient import discovery
+from googleapiclient import discovery
from oauth2client import appengine
from oauth2client import client
from google.appengine.api import memcache
diff --git a/samples/audit/audit.py b/samples/audit/audit.py
index eb43b40..af162c0 100644
--- a/samples/audit/audit.py
+++ b/samples/audit/audit.py
@@ -40,7 +40,7 @@
import sys
from oauth2client import client
-from apiclient import sample_tools
+from googleapiclient import sample_tools
def main(argv):
diff --git a/samples/blogger/blogger.py b/samples/blogger/blogger.py
index 035f5cd..331f500 100644
--- a/samples/blogger/blogger.py
+++ b/samples/blogger/blogger.py
@@ -37,7 +37,7 @@
import sys
from oauth2client import client
-from apiclient import sample_tools
+from googleapiclient import sample_tools
def main(argv):
diff --git a/samples/coordinate/coordinate.py b/samples/coordinate/coordinate.py
index 289a2c8..912fe71 100644
--- a/samples/coordinate/coordinate.py
+++ b/samples/coordinate/coordinate.py
@@ -43,7 +43,7 @@
import sys
from oauth2client import client
-from apiclient import sample_tools
+from googleapiclient import sample_tools
# Declare command-line flags.
argparser = argparse.ArgumentParser(add_help=False)
diff --git a/samples/customsearch/main.py b/samples/customsearch/main.py
index d7b6ac5..3e63924 100644
--- a/samples/customsearch/main.py
+++ b/samples/customsearch/main.py
@@ -24,7 +24,7 @@
import pprint
-from apiclient.discovery import build
+from googleapiclient.discovery import build
def main():
diff --git a/samples/dfareporting/create_report.py b/samples/dfareporting/create_report.py
index f2c301f..94efe56 100644
--- a/samples/dfareporting/create_report.py
+++ b/samples/dfareporting/create_report.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/delete_report.py b/samples/dfareporting/delete_report.py
index 8d518a6..ac60cd0 100644
--- a/samples/dfareporting/delete_report.py
+++ b/samples/dfareporting/delete_report.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/download_file.py b/samples/dfareporting/download_file.py
index af331f5..b03f547 100644
--- a/samples/dfareporting/download_file.py
+++ b/samples/dfareporting/download_file.py
@@ -24,7 +24,7 @@
import argparse
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/get_all_dimension_values.py b/samples/dfareporting/get_all_dimension_values.py
index 78d4f9c..fe6983d 100644
--- a/samples/dfareporting/get_all_dimension_values.py
+++ b/samples/dfareporting/get_all_dimension_values.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/get_all_files.py b/samples/dfareporting/get_all_files.py
index ca08698..3785cfc 100644
--- a/samples/dfareporting/get_all_files.py
+++ b/samples/dfareporting/get_all_files.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/get_all_report_files.py b/samples/dfareporting/get_all_report_files.py
index 9e27fed..9b6af0d 100644
--- a/samples/dfareporting/get_all_report_files.py
+++ b/samples/dfareporting/get_all_report_files.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/get_all_reports.py b/samples/dfareporting/get_all_reports.py
index 901b3a1..d36fc19 100644
--- a/samples/dfareporting/get_all_reports.py
+++ b/samples/dfareporting/get_all_reports.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/get_all_userprofiles.py b/samples/dfareporting/get_all_userprofiles.py
index 0be6258..ea1e57c 100644
--- a/samples/dfareporting/get_all_userprofiles.py
+++ b/samples/dfareporting/get_all_userprofiles.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
def main(argv):
diff --git a/samples/dfareporting/get_compatible_fields.py b/samples/dfareporting/get_compatible_fields.py
index 6fa77ce..d28f40a 100644
--- a/samples/dfareporting/get_compatible_fields.py
+++ b/samples/dfareporting/get_compatible_fields.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/get_report.py b/samples/dfareporting/get_report.py
index dbcde4e..8fbc298 100644
--- a/samples/dfareporting/get_report.py
+++ b/samples/dfareporting/get_report.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/get_report_file.py b/samples/dfareporting/get_report_file.py
index ad3ba8a..37b1fdb 100644
--- a/samples/dfareporting/get_report_file.py
+++ b/samples/dfareporting/get_report_file.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/get_userprofile.py b/samples/dfareporting/get_userprofile.py
index 391dd93..0d30f2a 100644
--- a/samples/dfareporting/get_userprofile.py
+++ b/samples/dfareporting/get_userprofile.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/patch_report.py b/samples/dfareporting/patch_report.py
index 2098984..fa7fbff 100644
--- a/samples/dfareporting/patch_report.py
+++ b/samples/dfareporting/patch_report.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/run_report.py b/samples/dfareporting/run_report.py
index 2e12435..f19d0af 100644
--- a/samples/dfareporting/run_report.py
+++ b/samples/dfareporting/run_report.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/dfareporting/update_report.py b/samples/dfareporting/update_report.py
index c0aef95..8dbfede 100644
--- a/samples/dfareporting/update_report.py
+++ b/samples/dfareporting/update_report.py
@@ -25,7 +25,7 @@
import pprint
import sys
-from apiclient import sample_tools
+from googleapiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
diff --git a/samples/django_sample/plus/views.py b/samples/django_sample/plus/views.py
index f273b8d..59587ca 100644
--- a/samples/django_sample/plus/views.py
+++ b/samples/django_sample/plus/views.py
@@ -2,7 +2,7 @@
import logging
import httplib2
-from apiclient.discovery import build
+from googleapiclient.discovery import build
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponse
diff --git a/samples/groupssettings/groupsettings.py b/samples/groupssettings/groupsettings.py
index 0e91bac..6ba2b43 100644
--- a/samples/groupssettings/groupsettings.py
+++ b/samples/groupssettings/groupsettings.py
@@ -32,7 +32,7 @@
import pprint
import sys
-from apiclient.discovery import build
+from googleapiclient.discovery import build
import httplib2
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
diff --git a/samples/maps_engine/README b/samples/maps_engine/README
deleted file mode 100644
index 1bcab84..0000000
--- a/samples/maps_engine/README
+++ /dev/null
@@ -1,8 +0,0 @@
-This sample code demonstrates use of Google Maps Engine. These samples do not
-make use of the Discovery Service, but do use the the httplib2 library to make
-authenticated requests. For more information on Google Maps Engine, see
-developers.google.com/maps-engine/documentation/
-
-api: mapsengine
-keywords: cmdline
-author: Josh Livni
diff --git a/samples/maps_engine/maps_engine.py b/samples/maps_engine/maps_engine.py
deleted file mode 100644
index 978145f..0000000
--- a/samples/maps_engine/maps_engine.py
+++ /dev/null
@@ -1,210 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2013 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.
-
-"""Simple command-line sample for Google Maps Engine.
-
-This sample code demonstrates use of Google Maps Engine. These samples do not
-make use of the Discovery Service, but do use the the httplib2 library to make
-authenticated requests. For more information on Google Maps Engine, see
-developers.google.com/maps-engine/documentation/
-
-These samples allow you to
-1) List projects you have access to, or
-2) List tables in a given project, and upload a shapefile.
-
-Usage:
- $ python maps_engine.py [-p project_id] [-s shapefile]
-
-If you do not enter a shapefile, it will upload the included "polygons".
-
-You can also get help on all the command-line flags the program understands
-by running:
-
- $ python maps_engine.py --help
-
-To get detailed log output run:
-
- $ python maps_engine.py -p 123456 --logging_level=DEBUG
-"""
-
-__author__ = "jlivni@google.com (Josh Livni)"
-
-import argparse
-import json
-import logging
-import sys
-import time
-
-import sample_tools
-
-logging.basicConfig(level=logging.INFO)
-
-# Declare command-line flags.
-argparser = argparse.ArgumentParser(add_help=False)
-argparser.add_argument("-p", "--project_id", help="optional GME Project ID")
-argparser.add_argument("-s", "--shapefile", help="Shapefile (without the .shp)")
-
-BASE_URL = "https://www.googleapis.com/mapsengine/v1/tables/"
-SUCCESSFUL_STATUS = ["processed", "complete", "ready"]
-
-class MapsEngineSampleException(Exception):
- """Catch this for failures specific to this sample code."""
-
-
-def ListProjects(http):
- """List the projects available to the authorized account.
-
- Args:
- http: http, authorized http object.
- """
-
- url = "https://www.googleapis.com/mapsengine/v1/projects"
- resp, content = http.request(url, method="GET")
- RaiseBadResponse(resp, url)
- logging.info(content)
-
-
-def ListTables(http, project_id):
- """List the tables in a given project.
-
- Args:
- http: http, authenticated http object.
- project_id: string, id of the GME project.
- """
- table_url = "https://www.googleapis.com/mapsengine/v1/tables?projectId=%s"
- url = table_url % project_id
- resp, content = http.request(url, method="GET")
- RaiseBadResponse(resp, url)
- logging.info(content)
-
-
-def UploadShapefile(http, project_id, shapefile_prefix):
- """Upload a shapefile to a given project, and display status when complete.
-
- Args:
- http: http, authenticated http object.
- project_id: string, id of the GME project.
- shapefile_prefix: string, the shapefile without the .shp suffix.
- """
- # Note the different endpoint for uploading the actual data.
- upload_url = "https://www.googleapis.com/upload/mapsengine/v1/tables/"
-
- # Ensure json encoding for POST
- headers = {"Content-Type": "application/json"}
-
- # Upload a file containing info about your upload
- suffixes = ["shp", "dbf", "prj", "shx"]
- files = []
- for suffix in suffixes:
- files.append({
- "filename": "%s.%s" % (shapefile_prefix, suffix)
- })
- metadata = {
- "projectId": project_id,
- "name": shapefile_prefix,
- "description": "polygons that were uploaded by a script",
- "files": files,
- # You need the string value of a valid shared and published ACL
- # Check the "Access Lists" section of the Maps Engine UI for a list.
- "draftAccessList": "Map Editors",
- "tags": [shapefile_prefix, "auto_upload", "kittens"]
- }
-
- body = json.dumps(metadata)
- create_url = "".join([BASE_URL, "upload"])
-
- logging.info("Uploading metadata for %s", shapefile_prefix)
-
- resp, content = http.request(create_url,
- method="POST",
- headers=headers,
- body=body)
- RaiseBadResponse(resp, create_url)
- logging.debug(content)
-
- # We have now created an empty asset. Get Table ID to upload the actual files.
- result = json.loads(content)
- table_id = result["id"]
-
- # A shapefile is actually a bunch of files; GME requires these for suffixes.
- for suffix in suffixes:
- shapefile = "%s.%s" % (shapefile_prefix, suffix)
- url = "%s%s/files?filename=%s" % (upload_url, table_id, shapefile)
- logging.debug("upload url is %s", url)
-
- with open(shapefile, "rb") as opened:
- headers = {
- "Content-Type": "application/octet-stream"
- }
-
- logging.info("Uploading %s", shapefile)
- resp, content = http.request(url,
- method="POST",
- headers=headers,
- body=opened)
- RaiseBadResponse(resp, url)
- logging.debug(content)
-
- # Check everything completed.
- CheckTableStatus(http, table_id)
-
-
-def CheckTableStatus(http, table_id):
- url = BASE_URL + table_id
- resp, content = http.request(url)
- RaiseBadResponse(resp, url)
- status = json.loads(content)["processingStatus"]
- logging.info("Table Status: %s", status)
- if status in SUCCESSFUL_STATUS:
- logging.info("table successfully processed; the table id is %s\n", table_id)
- cid = table_id.split("_")[0]
- gme_url = "https://earthbuilder.google.com/admin/#RepositoryPlace:"
- gme_url += "cid=%s&v=DETAIL_INFO&aid=%s" % (cid, table_id)
- logging.info("See it at %s", gme_url)
- else:
- logging.info("Table %s; will check again in 5 seconds", status)
- time.sleep(5)
- CheckTableStatus(http, table_id)
-
-
-def RaiseBadResponse(response, url):
- """Tests GME API returned a valid 2xx response.
-
- Args:
- response: the JSON response from the API.
- url: the original request URL.
- Raises:
- MapsEngineSampleException: Custom exception in case of non 2xx response.
- """
- if not response["status"].startswith("2"):
- raise MapsEngineSampleException("request failed: %s", url)
-
-
-def main(argv):
- http, flags = sample_tools.init(
- argv, "mapsengine", "v1", __doc__, __file__, parents=[argparser],
- scope="https://www.googleapis.com/auth/mapsengine")
-
- if flags.project_id:
- ListTables(http, flags.project_id)
- UploadShapefile(http, flags.project_id, flags.shapefile or "polygons")
- else:
- ListProjects(http)
- return
-
-
-if __name__ == "__main__":
- main(sys.argv)
diff --git a/samples/maps_engine/polygons.prj b/samples/maps_engine/polygons.prj
deleted file mode 100644
index 8f73f48..0000000
--- a/samples/maps_engine/polygons.prj
+++ /dev/null
@@ -1 +0,0 @@
-GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
diff --git a/samples/maps_engine/sample_tools.py b/samples/maps_engine/sample_tools.py
deleted file mode 100644
index a08bd71..0000000
--- a/samples/maps_engine/sample_tools.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright 2013 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.
-
-"""Utilities for making samples.
-
-Consolidates a lot of code commonly repeated in sample applications.
-
-This modified version returns http instead of a built service. Originally
-https://google-api-python-client.googlecode.com/hg/apiclient/sample_tools.py
-"""
-
-__author__ = 'jcgregorio@google.com (Joe Gregorio)'
-__all__ = ['init']
-
-
-import argparse
-import os
-
-import httplib2
-from oauth2client import client
-from oauth2client import file as oauth2client_file
-from oauth2client import tools
-
-
-def init(argv, name, version, doc, filename, scope=None, parents=[]):
- """A common initialization routine for samples.
-
- Many of the sample applications do the same initialization, which has now
- been consolidated into this function. This function uses common idioms found
- in almost all the samples, i.e. for an API with name 'apiname', the
- credentials are stored in a file named apiname.dat, and the
- client_secrets.json file is stored in the same directory as the application
- main file.
-
- Args:
- argv: list of string, the command-line parameters of the application.
- name: string, name of the API.
- version: string, version of the API.
- doc: string, description of the application. Usually set to __doc__.
- filename: string, filename of the application. Usually set to __file__.
- scope: string, The OAuth scope used.
- parents: list of argparse.ArgumentParser, additional command-line flags.
-
- Returns:
- A tuple of (http, flags), where http is the authenticated http object and
- flags is the parsed command-line flags.
- """
- if scope is None:
- scope = 'https://www.googleapis.com/auth/' + name
-
- # Parser command-line arguments.
- parent_parsers = [tools.argparser]
- parent_parsers.extend(parents)
- parser = argparse.ArgumentParser(
- description=doc,
- formatter_class=argparse.RawDescriptionHelpFormatter,
- parents=parent_parsers)
- flags = parser.parse_args(argv[1:])
-
- # Name of a file containing the OAuth 2.0 information for this
- # application, including client_id and client_secret, which are found
- # on the API Access tab on the Google APIs
- # Console <http://code.google.com/apis/console>.
- client_secrets = os.path.join(os.path.dirname(filename),
- 'client_secrets.json')
-
- # Set up a Flow object to be used if we need to authenticate.
- flow = client.flow_from_clientsecrets(
- client_secrets,
- scope=scope,
- message=tools.message_if_missing(client_secrets))
-
- # Prepare credentials, and authorize HTTP object with them.
- # If the credentials don't exist or are invalid run through the native client
- # flow. The Storage object will ensure that if successful the good
- # credentials will get written back to a file.
- storage = oauth2client_file.Storage(name + '.dat')
- credentials = storage.get()
- if credentials is None or credentials.invalid:
- credentials = tools.run_flow(flow, storage, flags)
- http = credentials.authorize(http=httplib2.Http())
-
- # GME does not publish a discovery document, so we return the auth'd http
- # instead of building a service using the discovery module.
- return (http, flags)
diff --git a/samples/plus/plus.py b/samples/plus/plus.py
index d8375ca..b9dde0c 100755
--- a/samples/plus/plus.py
+++ b/samples/plus/plus.py
@@ -24,7 +24,7 @@
import sys
from oauth2client import client
-from apiclient import sample_tools
+from googleapiclient import sample_tools
def main(argv):
diff --git a/samples/prediction/prediction.py b/samples/prediction/prediction.py
index 9f33dfb..a130f2a 100644
--- a/samples/prediction/prediction.py
+++ b/samples/prediction/prediction.py
@@ -43,8 +43,8 @@
import sys
import time
-from apiclient import discovery
-from apiclient import sample_tools
+from googleapiclient import discovery
+from googleapiclient import sample_tools
from oauth2client import client
diff --git a/samples/searchforshopping/basic.py b/samples/searchforshopping/basic.py
index 96feeb6..2473ac6 100644
--- a/samples/searchforshopping/basic.py
+++ b/samples/searchforshopping/basic.py
@@ -7,7 +7,7 @@
import pprint
-from apiclient.discovery import build
+from googleapiclient.discovery import build
SHOPPING_API_VERSION = 'v1'
diff --git a/samples/searchforshopping/crowding.py b/samples/searchforshopping/crowding.py
index 2eea38f..dd2e55f 100644
--- a/samples/searchforshopping/crowding.py
+++ b/samples/searchforshopping/crowding.py
@@ -7,7 +7,7 @@
import pprint
-from apiclient.discovery import build
+from googleapiclient.discovery import build
SHOPPING_API_VERSION = 'v1'
diff --git a/samples/searchforshopping/fulltextsearch.py b/samples/searchforshopping/fulltextsearch.py
index f838223..72c04ee 100644
--- a/samples/searchforshopping/fulltextsearch.py
+++ b/samples/searchforshopping/fulltextsearch.py
@@ -7,7 +7,7 @@
import pprint
-from apiclient.discovery import build
+from googleapiclient.discovery import build
SHOPPING_API_VERSION = 'v1'
diff --git a/samples/searchforshopping/histograms.py b/samples/searchforshopping/histograms.py
index 6bd3a2f..6cfa550 100644
--- a/samples/searchforshopping/histograms.py
+++ b/samples/searchforshopping/histograms.py
@@ -5,7 +5,7 @@
"""Query with ranked results against the shopping search API"""
-from apiclient.discovery import build
+from googleapiclient.discovery import build
SHOPPING_API_VERSION = 'v1'
diff --git a/samples/searchforshopping/main.py b/samples/searchforshopping/main.py
index 9b73cb1..7ae56c4 100644
--- a/samples/searchforshopping/main.py
+++ b/samples/searchforshopping/main.py
@@ -11,7 +11,7 @@
__author__ = 'aherrman@google.com (Andy Herrman)'
-from apiclient.discovery import build
+from googleapiclient.discovery import build
# Uncomment the next line to get very detailed logging
# httplib2.debuglevel = 4
diff --git a/samples/searchforshopping/pagination.py b/samples/searchforshopping/pagination.py
index c938247..c55511c 100644
--- a/samples/searchforshopping/pagination.py
+++ b/samples/searchforshopping/pagination.py
@@ -7,7 +7,7 @@
import pprint
-from apiclient.discovery import build
+from googleapiclient.discovery import build
SHOPPING_API_VERSION = 'v1'
diff --git a/samples/searchforshopping/ranking.py b/samples/searchforshopping/ranking.py
index 86ad2ee..b515f82 100644
--- a/samples/searchforshopping/ranking.py
+++ b/samples/searchforshopping/ranking.py
@@ -7,7 +7,7 @@
import pprint
-from apiclient.discovery import build
+from googleapiclient.discovery import build
SHOPPING_API_VERSION = 'v1'
diff --git a/samples/searchforshopping/restricting.py b/samples/searchforshopping/restricting.py
index 1d21c69..050502c 100644
--- a/samples/searchforshopping/restricting.py
+++ b/samples/searchforshopping/restricting.py
@@ -8,7 +8,7 @@
import pprint
-from apiclient.discovery import build
+from googleapiclient.discovery import build
SHOPPING_API_VERSION = 'v1'
diff --git a/samples/service_account/tasks.py b/samples/service_account/tasks.py
index 54f4936..5be99f3 100644
--- a/samples/service_account/tasks.py
+++ b/samples/service_account/tasks.py
@@ -33,7 +33,7 @@
import pprint
import sys
-from apiclient.discovery import build
+from googleapiclient.discovery import build
from oauth2client.client import SignedJwtAssertionCredentials
def main(argv):
diff --git a/samples/tasks_appengine/main.py b/samples/tasks_appengine/main.py
index 9925dea..2b00570 100644
--- a/samples/tasks_appengine/main.py
+++ b/samples/tasks_appengine/main.py
@@ -15,7 +15,7 @@
import webapp2
from webapp2_extras import jinja2
-from apiclient.discovery import build
+from googleapiclient.discovery import build
from oauth2client.appengine import OAuth2Decorator
import settings
diff --git a/samples/translate/main.py b/samples/translate/main.py
index 04db09a..9617a6f 100644
--- a/samples/translate/main.py
+++ b/samples/translate/main.py
@@ -22,7 +22,7 @@
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
-from apiclient.discovery import build
+from googleapiclient.discovery import build
def main():
diff --git a/samples/urlshortener/urlshortener.py b/samples/urlshortener/urlshortener.py
index b3dbbcd..9efff0d 100644
--- a/samples/urlshortener/urlshortener.py
+++ b/samples/urlshortener/urlshortener.py
@@ -39,7 +39,7 @@
import sys
from oauth2client import client
-from apiclient import sample_tools
+from googleapiclient import sample_tools
def main(argv):
service, flags = sample_tools.init(