Skip to content

Commit 386b6df

Browse files
dhermeslukesneeringer
authored andcommitted
Adding GCCL header for HTTP APIs. (#3046)
1 parent 5444267 commit 386b6df

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/google-cloud-datastore/google/cloud/datastore/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
"""
5555

5656

57+
from pkg_resources import get_distribution
58+
__version__ = get_distribution('google-cloud-datastore').version
59+
5760
from google.cloud.datastore.batch import Batch
5861
from google.cloud.datastore.client import Client
5962
from google.cloud.datastore.entity import Entity

packages/google-cloud-datastore/google/cloud/datastore/_http.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"""Connections to Google Cloud Datastore API servers."""
1616

1717
import os
18-
from pkg_resources import get_distribution
1918

2019
from google.rpc import status_pb2
2120

@@ -24,6 +23,8 @@
2423
from google.cloud.environment_vars import GCD_HOST
2524
from google.cloud import exceptions
2625
from google.cloud.grpc.datastore.v1 import datastore_pb2 as _datastore_pb2
26+
27+
from google.cloud.datastore import __version__
2728
try:
2829
from google.cloud.datastore._gax import _DatastoreAPIOverGRPC
2930
_HAVE_GRPC = True
@@ -37,9 +38,7 @@
3738

3839
_DISABLE_GRPC = os.getenv(DISABLE_GRPC, False)
3940
_USE_GRPC = _HAVE_GRPC and not _DISABLE_GRPC
40-
_DATASTORE_DIST = get_distribution('google-cloud-datastore')
41-
_CLIENT_INFO = connection_module.CLIENT_INFO_TEMPLATE.format(
42-
_DATASTORE_DIST.version)
41+
_CLIENT_INFO = connection_module.CLIENT_INFO_TEMPLATE.format(__version__)
4342

4443

4544
class _DatastoreAPIOverHttp(object):

0 commit comments

Comments
 (0)