Skip to content

Commit

Permalink
Adding gccl header for remaining HTTP Connections.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Feb 22, 2017
1 parent 5a9f079 commit 579a9cc
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bigquery/google/cloud/bigquery/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

from google.cloud import _http

from google.cloud.bigquery import __version__


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


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

API_URL_TEMPLATE = '{api_base_url}/bigquery/{api_version}{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}
9 changes: 9 additions & 0 deletions dns/google/cloud/dns/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

from google.cloud import _http

from google.cloud.dns import __version__


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


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

API_URL_TEMPLATE = '{api_base_url}/dns/{api_version}{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}
9 changes: 9 additions & 0 deletions language/google/cloud/language/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

from google.cloud import _http

from google.cloud.language import __version__


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


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

API_URL_TEMPLATE = '{api_base_url}/{api_version}/documents:{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}
9 changes: 9 additions & 0 deletions logging/google/cloud/logging/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@

from google.cloud import _http
from google.cloud.iterator import HTTPIterator

from google.cloud.logging import __version__
from google.cloud.logging._helpers import entry_from_resource
from google.cloud.logging.sink import Sink
from google.cloud.logging.metric import Metric


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


class Connection(_http.JSONConnection):
"""A connection to Google Stackdriver Logging via the JSON REST API.
Expand All @@ -39,6 +44,10 @@ class Connection(_http.JSONConnection):
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}


class _LoggingAPI(object):
"""Helper mapping logging-related APIs.
Expand Down
9 changes: 9 additions & 0 deletions monitoring/google/cloud/monitoring/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

from google.cloud import _http

from google.cloud.monitoring import __version__


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


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

API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}
8 changes: 8 additions & 0 deletions pubsub/google/cloud/pubsub/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from google.cloud import _http
from google.cloud.environment_vars import PUBSUB_EMULATOR
from google.cloud.iterator import HTTPIterator

from google.cloud.pubsub import __version__
from google.cloud.pubsub._helpers import subscription_name_from_path
from google.cloud.pubsub.subscription import Subscription
from google.cloud.pubsub.topic import Topic
Expand All @@ -30,6 +32,8 @@
PUBSUB_API_HOST = 'pubsub.googleapis.com'
"""Pub / Sub API request host."""

_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


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

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}

def __init__(self, client):
super(Connection, self).__init__(client)
emulator_host = os.getenv(PUBSUB_EMULATOR)
Expand Down
9 changes: 9 additions & 0 deletions resource_manager/google/cloud/resource_manager/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

from google.cloud import _http

from google.cloud.resource_manager import __version__


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


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

API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}
9 changes: 9 additions & 0 deletions runtimeconfig/google/cloud/runtimeconfig/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

from google.cloud import _http

from google.cloud.runtimeconfig import __version__


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


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

API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}
8 changes: 8 additions & 0 deletions speech/google/cloud/speech/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
from google.cloud._helpers import _to_bytes
from google.cloud import _http

from google.cloud.speech import __version__
from google.cloud.speech.result import Result
from google.cloud.speech.operation import Operation


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


class Connection(_http.JSONConnection):
"""A connection to Google Cloud Speech JSON REST API.
Expand All @@ -40,6 +44,10 @@ class Connection(_http.JSONConnection):
API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}


class HTTPSpeechAPI(object):
"""Speech API for interacting with the HTTP version of the API.
Expand Down
9 changes: 9 additions & 0 deletions translate/google/cloud/translate/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

from google.cloud import _http

from google.cloud.translate import __version__


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


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

API_URL_TEMPLATE = '{api_base_url}/language/translate/{api_version}{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}
9 changes: 9 additions & 0 deletions vision/google/cloud/vision/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@

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


from google.cloud import _http

from google.cloud.vision import __version__
from google.cloud.vision.annotations import Annotations
from google.cloud.vision.feature import Feature


_CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__)


class Connection(_http.JSONConnection):
"""A connection to Google Cloud Vision via the JSON REST API.
Expand All @@ -36,6 +41,10 @@ class Connection(_http.JSONConnection):
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
"""A template for the URL of a particular API call."""

_EXTRA_HEADERS = {
_http.CLIENT_INFO_HEADER: _CLIENT_INFO,
}


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

0 comments on commit 579a9cc

Please sign in to comment.