From 20acc93a52b46adbb91779d2caa3e1e57aba454b Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Fri, 26 Sep 2014 20:45:48 -0700 Subject: [PATCH] Making datastore.connection.Connection inherit from base Connection. Fixes #197. --- gcloud/datastore/connection.py | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/gcloud/datastore/connection.py b/gcloud/datastore/connection.py index cd04302496bdc..337468caf01ca 100644 --- a/gcloud/datastore/connection.py +++ b/gcloud/datastore/connection.py @@ -1,12 +1,13 @@ import httplib2 +from gcloud import connection from gcloud.datastore import datastore_v1_pb2 as datastore_pb from gcloud.datastore import helpers from gcloud.datastore.dataset import Dataset from gcloud.datastore.transaction import Transaction -class Connection(object): +class Connection(connection.Connection): """A connection to the Google Cloud Datastore via the Protobuf API. This class should understand only the basic types (and protobufs) @@ -16,9 +17,6 @@ class Connection(object): :param credentials: The OAuth2 Credentials to use for this connection. """ - API_BASE_URL = 'https://www.googleapis.com' - """The base of the API call URL.""" - API_VERSION = 'v1beta2' """The version of the API, used in building the API call's URL.""" @@ -26,32 +24,11 @@ class Connection(object): '/datasets/{dataset_id}/{method}') """A template used to craft the URL pointing toward a particular API call.""" - _EMPTY = object() - """A pointer to represent an empty value for default arguments.""" - def __init__(self, credentials=None): self._credentials = credentials self._current_transaction = None self._http = None - @property - def credentials(self): - return self._credentials - - @property - def http(self): - """A getter for the HTTP transport used in talking to the API. - - :rtype: :class:`httplib2.Http` - :returns: A Http object used to transport data. - """ - - if not self._http: - self._http = httplib2.Http() - if self._credentials: - self._http = self._credentials.authorize(self._http) - return self._http - def _request(self, dataset_id, method, data): """Make a request over the Http transport to the Cloud Datastore API.