Пример #1
0
 def __init__(self, project=None, credentials=None, http=None):
     self._base_connection = None
     super(Client, self).__init__(project=project,
                                  credentials=credentials,
                                  http=http)
     self._connection = Connection(self)
     self._batch_stack = _LocalStack()
Пример #2
0
    def __init__(
        self,
        project=_marker,
        credentials=None,
        _http=None,
        client_info=None,
        client_options=None,
    ):
        self._base_connection = None
        if project is None:
            no_project = True
            project = "<none>"
        else:
            no_project = False
        if project is _marker:
            project = None
        super(Client, self).__init__(project=project,
                                     credentials=credentials,
                                     _http=_http)

        kw_args = {"client_info": client_info}
        if client_options:
            if type(client_options) == dict:
                client_options = google.api_core.client_options.from_dict(
                    client_options)
            if client_options.api_endpoint:
                api_endpoint = client_options.api_endpoint
                kw_args["api_endpoint"] = api_endpoint

        if no_project:
            self.project = None
        self._connection = Connection(self, **kw_args)
        self._batch_stack = _LocalStack()
Пример #3
0
    def __init__(self,
                 project=None,
                 namespace=None,
                 credentials=None,
                 _http=None,
                 _use_grpc=None):

        host = os.getenv(GCD_HOST)
        if host:
            project = project or 'other'
            credentials = credentials or EmulatorCreds()

        super(Client, self).__init__(project=project,
                                     credentials=credentials,
                                     _http=_http)
        self.namespace = namespace
        self._batch_stack = _LocalStack()
        self._datastore_api_internal = None
        if _use_grpc is None:
            self._use_grpc = _USE_GRPC
        else:
            self._use_grpc = _use_grpc

        if host:
            self._base_url = 'http://' + host
        else:
            self._base_url = _DATASTORE_BASE_URL
Пример #4
0
 def __init__(
     self,
     project=None,
     namespace=None,
     credentials=None,
     client_info=_CLIENT_INFO,
     _http=None,
     _use_grpc=None,
 ):
     super(Client, self).__init__(project=project,
                                  credentials=credentials,
                                  _http=_http)
     self.namespace = namespace
     self._client_info = client_info
     self._batch_stack = _LocalStack()
     self._datastore_api_internal = None
     if _use_grpc is None:
         self._use_grpc = _USE_GRPC
     else:
         self._use_grpc = _use_grpc
     try:
         host = os.environ[GCD_HOST]
         self._base_url = "http://" + host
     except KeyError:
         self._base_url = _DATASTORE_BASE_URL
Пример #5
0
 def __init__(
     self,
     project=None,
     namespace=None,
     credentials=None,
     client_info=_CLIENT_INFO,
     _http=None,
     _use_grpc=None,
 ):
     super(Client, self).__init__(
         project=project, credentials=credentials, _http=_http
     )
     self.namespace = namespace
     self._client_info = client_info
     self._batch_stack = _LocalStack()
     self._datastore_api_internal = None
     if _use_grpc is None:
         self._use_grpc = _USE_GRPC
     else:
         self._use_grpc = _use_grpc
     try:
         host = os.environ[GCD_HOST]
         self._base_url = "http://" + host
     except KeyError:
         self._base_url = _DATASTORE_BASE_URL
Пример #6
0
 def __init__(
     self,
     project=None,
     namespace=None,
     credentials=None,
     client_info=_CLIENT_INFO,
     client_options=None,
     _http=None,
     _use_grpc=None,
 ):
     super(Client, self).__init__(project=project,
                                  credentials=credentials,
                                  _http=_http)
     self.namespace = namespace
     self._client_info = client_info
     self._client_options = client_options
     self._batch_stack = _LocalStack()
     self._datastore_api_internal = None
     if _use_grpc is None:
         self._use_grpc = _USE_GRPC
     else:
         self._use_grpc = _use_grpc
     try:
         host = os.environ[GCD_HOST]
         self._base_url = "http://" + host
     except KeyError:
         api_endpoint = _DATASTORE_BASE_URL
         if client_options:
             if type(client_options) == dict:
                 client_options = google.api_core.client_options.from_dict(
                     client_options)
             if client_options.api_endpoint:
                 api_endpoint = client_options.api_endpoint
         self._base_url = api_endpoint
Пример #7
0
 def __init__(self, project=None, credentials=None, http=None):
     self._base_connection = None
     super(Client, self).__init__(project=project, credentials=credentials,
                                  http=http)
     self._connection = Connection(
         credentials=self._credentials, http=self._http)
     self._batch_stack = _LocalStack()
Пример #8
0
 def __init__(self,
              project=None,
              namespace=None,
              credentials=None,
              http=None):
     _ClientProjectMixin.__init__(self, project=project)
     self.namespace = namespace
     self._batch_stack = _LocalStack()
     super(Client, self).__init__(credentials, http)
Пример #9
0
    def __init__(self, project=None, namespace=None,
                 credentials=None, http=None):
        _ClientProjectMixin.__init__(self, project=project)
        _BaseClient.__init__(self, credentials=credentials, http=http)
        self._connection = Connection(
            credentials=self._credentials, http=self._http)

        self.namespace = namespace
        self._batch_stack = _LocalStack()
Пример #10
0
    def __init__(self,
                 project=None,
                 namespace=None,
                 credentials=None,
                 http=None):
        _ClientProjectMixin.__init__(self, project=project)
        _BaseClient.__init__(self, credentials=credentials, http=http)
        self._connection = Connection(credentials=self._credentials,
                                      http=self._http)

        self.namespace = namespace
        self._batch_stack = _LocalStack()
Пример #11
0
    def __init__(
        self,
        project=None,
        namespace=None,
        credentials=None,
        client_info=_CLIENT_INFO,
        client_options=None,
        _http=None,
        _use_grpc=None,
    ):
        emulator_host = os.getenv(DATASTORE_EMULATOR_HOST)

        if emulator_host is not None:
            if credentials is not None:
                raise ValueError(
                    "Explicit credentials are incompatible with the emulator"
                )
            credentials = AnonymousCredentials()

        super(Client, self).__init__(
            project=project,
            credentials=credentials,
            client_options=client_options,
            _http=_http,
        )
        self.namespace = namespace
        self._client_info = client_info
        self._client_options = client_options
        self._batch_stack = _LocalStack()
        self._datastore_api_internal = None

        if _use_grpc is None:
            self._use_grpc = _USE_GRPC
        else:
            self._use_grpc = _use_grpc

        if emulator_host is not None:
            self._base_url = "http://" + emulator_host
        else:
            api_endpoint = _DATASTORE_BASE_URL
            if client_options:
                if type(client_options) == dict:
                    client_options = google.api_core.client_options.from_dict(
                        client_options
                    )
                if client_options.api_endpoint:
                    api_endpoint = client_options.api_endpoint
            self._base_url = api_endpoint
Пример #12
0
 def __init__(self, project=_marker, credentials=None, _http=None):
     self._base_connection = None
     if project is None:
         no_project = True
         project = '<none>'
     else:
         no_project = False
     if project is _marker:
         project = None
     super(Client, self).__init__(project=project,
                                  credentials=credentials,
                                  _http=_http)
     if no_project:
         self.project = None
     self._connection = Connection(self)
     self._batch_stack = _LocalStack()
Пример #13
0
 def __init__(self, project=None, namespace=None,
              credentials=None, http=None, use_gax=None):
     super(Client, self).__init__(
         project=project, credentials=credentials, http=http)
     self.namespace = namespace
     self._batch_stack = _LocalStack()
     self._datastore_api_internal = None
     if use_gax is None:
         self._use_gax = _USE_GAX
     else:
         self._use_gax = use_gax
     try:
         host = os.environ[GCD_HOST]
         self._base_url = 'http://' + host
     except KeyError:
         self._base_url = _DATASTORE_BASE_URL
Пример #14
0
 def __init__(self, project=_marker, credentials=None, _http=None, client_info=None):
     self._base_connection = None
     if project is None:
         no_project = True
         project = "<none>"
     else:
         no_project = False
     if project is _marker:
         project = None
     super(Client, self).__init__(
         project=project, credentials=credentials, _http=_http
     )
     if no_project:
         self.project = None
     self._connection = Connection(self, client_info=client_info)
     self._batch_stack = _LocalStack()
Пример #15
0
 def __init__(self,
              project=None,
              namespace=None,
              credentials=None,
              http=None,
              use_gax=None):
     super(Client, self).__init__(project=project,
                                  credentials=credentials,
                                  http=http)
     self.namespace = namespace
     self._batch_stack = _LocalStack()
     self._datastore_api_internal = None
     if use_gax is None:
         self._use_gax = _USE_GAX
     else:
         self._use_gax = use_gax
     try:
         host = os.environ[GCD_HOST]
         self._base_url = 'http://' + host
     except KeyError:
         self._base_url = _DATASTORE_BASE_URL
     # NOTE: Make sure all properties are set before passing to
     #       ``Connection`` (e.g. ``_base_url``).
     self._connection = Connection(self)
Пример #16
0
 def __init__(self, project=None, namespace=None,
              credentials=None, http=None):
     _ClientProjectMixin.__init__(self, project=project)
     self.namespace = namespace
     self._batch_stack = _LocalStack()
     super(Client, self).__init__(credentials, http)