Skip to content

Commit 579a9cc

Browse files
committed
Adding gccl header for remaining HTTP Connections.
1 parent 5a9f079 commit 579a9cc

File tree

11 files changed

+97
-0
lines changed

11 files changed

+97
-0
lines changed

bigquery/google/cloud/bigquery/_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
from google.cloud import _http
1818

19+
from google.cloud.bigquery import __version__
20+
21+
22+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
23+
1924

2025
class Connection(_http.JSONConnection):
2126
"""A connection to Google BigQuery via the JSON REST API.
@@ -32,3 +37,7 @@ class Connection(_http.JSONConnection):
3237

3338
API_URL_TEMPLATE = '{api_base_url}/bigquery/{api_version}{path}'
3439
"""A template for the URL of a particular API call."""
40+
41+
_EXTRA_HEADERS = {
42+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
43+
}

dns/google/cloud/dns/_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
from google.cloud import _http
1818

19+
from google.cloud.dns import __version__
20+
21+
22+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
23+
1924

2025
class Connection(_http.JSONConnection):
2126
"""A connection to Google Cloud DNS via the JSON REST API.
@@ -32,3 +37,7 @@ class Connection(_http.JSONConnection):
3237

3338
API_URL_TEMPLATE = '{api_base_url}/dns/{api_version}{path}'
3439
"""A template for the URL of a particular API call."""
40+
41+
_EXTRA_HEADERS = {
42+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
43+
}

language/google/cloud/language/_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
from google.cloud import _http
1818

19+
from google.cloud.language import __version__
20+
21+
22+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
23+
1924

2025
class Connection(_http.JSONConnection):
2126
"""A connection to Google Cloud Natural Language JSON REST API.
@@ -32,3 +37,7 @@ class Connection(_http.JSONConnection):
3237

3338
API_URL_TEMPLATE = '{api_base_url}/{api_version}/documents:{path}'
3439
"""A template for the URL of a particular API call."""
40+
41+
_EXTRA_HEADERS = {
42+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
43+
}

logging/google/cloud/logging/_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@
1818

1919
from google.cloud import _http
2020
from google.cloud.iterator import HTTPIterator
21+
22+
from google.cloud.logging import __version__
2123
from google.cloud.logging._helpers import entry_from_resource
2224
from google.cloud.logging.sink import Sink
2325
from google.cloud.logging.metric import Metric
2426

2527

28+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
29+
30+
2631
class Connection(_http.JSONConnection):
2732
"""A connection to Google Stackdriver Logging via the JSON REST API.
2833
@@ -39,6 +44,10 @@ class Connection(_http.JSONConnection):
3944
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
4045
"""A template for the URL of a particular API call."""
4146

47+
_EXTRA_HEADERS = {
48+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
49+
}
50+
4251

4352
class _LoggingAPI(object):
4453
"""Helper mapping logging-related APIs.

monitoring/google/cloud/monitoring/_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
from google.cloud import _http
1818

19+
from google.cloud.monitoring import __version__
20+
21+
22+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
23+
1924

2025
class Connection(_http.JSONConnection):
2126
"""A connection to Google Stackdriver Monitoring via the JSON REST API.
@@ -32,3 +37,7 @@ class Connection(_http.JSONConnection):
3237

3338
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
3439
"""A template for the URL of a particular API call."""
40+
41+
_EXTRA_HEADERS = {
42+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
43+
}

pubsub/google/cloud/pubsub/_http.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from google.cloud import _http
2323
from google.cloud.environment_vars import PUBSUB_EMULATOR
2424
from google.cloud.iterator import HTTPIterator
25+
26+
from google.cloud.pubsub import __version__
2527
from google.cloud.pubsub._helpers import subscription_name_from_path
2628
from google.cloud.pubsub.subscription import Subscription
2729
from google.cloud.pubsub.topic import Topic
@@ -30,6 +32,8 @@
3032
PUBSUB_API_HOST = 'pubsub.googleapis.com'
3133
"""Pub / Sub API request host."""
3234

35+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
36+
3337

3438
class Connection(_http.JSONConnection):
3539
"""A connection to Google Cloud Pub/Sub via the JSON REST API.
@@ -47,6 +51,10 @@ class Connection(_http.JSONConnection):
4751
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
4852
"""A template for the URL of a particular API call."""
4953

54+
_EXTRA_HEADERS = {
55+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
56+
}
57+
5058
def __init__(self, client):
5159
super(Connection, self).__init__(client)
5260
emulator_host = os.getenv(PUBSUB_EMULATOR)

resource_manager/google/cloud/resource_manager/_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
from google.cloud import _http
1919

20+
from google.cloud.resource_manager import __version__
21+
22+
23+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
24+
2025

2126
class Connection(_http.JSONConnection):
2227
"""A connection to Google Cloud Resource Manager via the JSON REST API.
@@ -33,3 +38,7 @@ class Connection(_http.JSONConnection):
3338

3439
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
3540
"""A template for the URL of a particular API call."""
41+
42+
_EXTRA_HEADERS = {
43+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
44+
}

runtimeconfig/google/cloud/runtimeconfig/_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
from google.cloud import _http
2020

21+
from google.cloud.runtimeconfig import __version__
22+
23+
24+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
25+
2126

2227
class Connection(_http.JSONConnection):
2328
"""A connection to Google Cloud RuntimeConfig via the JSON REST API.
@@ -34,3 +39,7 @@ class Connection(_http.JSONConnection):
3439

3540
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
3641
"""A template for the URL of a particular API call."""
42+
43+
_EXTRA_HEADERS = {
44+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
45+
}

speech/google/cloud/speech/_http.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020
from google.cloud._helpers import _to_bytes
2121
from google.cloud import _http
2222

23+
from google.cloud.speech import __version__
2324
from google.cloud.speech.result import Result
2425
from google.cloud.speech.operation import Operation
2526

2627

28+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
29+
30+
2731
class Connection(_http.JSONConnection):
2832
"""A connection to Google Cloud Speech JSON REST API.
2933
@@ -40,6 +44,10 @@ class Connection(_http.JSONConnection):
4044
API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}'
4145
"""A template for the URL of a particular API call."""
4246

47+
_EXTRA_HEADERS = {
48+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
49+
}
50+
4351

4452
class HTTPSpeechAPI(object):
4553
"""Speech API for interacting with the HTTP version of the API.

translate/google/cloud/translate/_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
from google.cloud import _http
1818

19+
from google.cloud.translate import __version__
20+
21+
22+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
23+
1924

2025
class Connection(_http.JSONConnection):
2126
"""A connection to Google Cloud Translation API via the JSON REST API.
@@ -32,3 +37,7 @@ class Connection(_http.JSONConnection):
3237

3338
API_URL_TEMPLATE = '{api_base_url}/language/translate/{api_version}{path}'
3439
"""A template for the URL of a particular API call."""
40+
41+
_EXTRA_HEADERS = {
42+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
43+
}

vision/google/cloud/vision/_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@
1414

1515
"""HTTP Client for interacting with the Google Cloud Vision API."""
1616

17+
1718
from google.cloud import _http
1819

20+
from google.cloud.vision import __version__
1921
from google.cloud.vision.annotations import Annotations
2022
from google.cloud.vision.feature import Feature
2123

2224

25+
_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)
26+
27+
2328
class Connection(_http.JSONConnection):
2429
"""A connection to Google Cloud Vision via the JSON REST API.
2530
@@ -36,6 +41,10 @@ class Connection(_http.JSONConnection):
3641
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
3742
"""A template for the URL of a particular API call."""
3843

44+
_EXTRA_HEADERS = {
45+
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
46+
}
47+
3948

4049
class _HTTPVisionAPI(object):
4150
"""Vision API for interacting with the JSON/HTTP version of Vision

0 commit comments

Comments
 (0)