1818from gcloud ._helpers import _LocalStack
1919from gcloud ._helpers import _app_engine_id
2020from gcloud ._helpers import _compute_engine_id
21+ from gcloud .client import Client as _BaseClient
2122from gcloud .datastore import helpers
2223from gcloud .datastore .connection import Connection
2324from gcloud .datastore .batch import Batch
@@ -158,7 +159,7 @@ def _extended_lookup(connection, dataset_id, key_pbs,
158159 return results
159160
160161
161- class Client (object ):
162+ class Client (_BaseClient ):
162163 """Convenience wrapper for invoking APIs/factories w/ a dataset ID.
163164
164165 :type dataset_id: string
@@ -167,20 +168,29 @@ class Client(object):
167168 :type namespace: string
168169 :param namespace: (optional) namespace to pass to proxied API methods.
169170
170- :type connection: :class:`gcloud.datastore.connection.Connection`, or None
171- :param connection: (optional) connection to pass to proxied API methods
171+ :type credentials: :class:`oauth2client.client.OAuth2Credentials` or
172+ :class:`NoneType`
173+ :param credentials: The OAuth2 Credentials to use for the connection
174+ owned by this client. If not passed (and if no ``http``
175+ object is passed), falls back to the default inferred
176+ from the environment.
177+
178+ :type http: :class:`httplib2.Http` or class that defines ``request()``.
179+ :param http: An optional HTTP object to make requests. If not passed, an
180+ ``http`` object is created that is bound to the
181+ ``credentials`` for the current object.
172182 """
183+ _connection_class = Connection
173184
174- def __init__ (self , dataset_id = None , namespace = None , connection = None ):
185+ def __init__ (self , dataset_id = None , namespace = None ,
186+ credentials = None , http = None ):
175187 dataset_id = _determine_default_dataset_id (dataset_id )
176188 if dataset_id is None :
177189 raise EnvironmentError ('Dataset ID could not be inferred.' )
178190 self .dataset_id = dataset_id
179- if connection is None :
180- connection = Connection .from_environment ()
181- self .connection = connection
182- self ._batch_stack = _LocalStack ()
183191 self .namespace = namespace
192+ self ._batch_stack = _LocalStack ()
193+ super (Client , self ).__init__ (credentials , http )
184194
185195 def _push_batch (self , batch ):
186196 """Push a batch/transaction onto our stack.
0 commit comments