Skip to content

Commit

Permalink
Change build_api_url to an instance method.
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 committed Jul 26, 2019
1 parent 79e0210 commit 75a4b66
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions core/google/cloud/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ class JSONConnection(Connection):
This defines :meth:`api_request` for making a generic JSON
API request and API requests are created elsewhere.
The class constants
* :attr:`API_BASE_URL`
* :attr:`API_VERSION`
* :attr:`API_URL_TEMPLATE`
Expand All @@ -177,9 +175,8 @@ class JSONConnection(Connection):
API_URL_TEMPLATE = None
"""A template for the URL of a particular API call."""

@classmethod
def build_api_url(
cls, path, query_params=None, api_base_url=None, api_version=None
self, path, query_params=None, api_base_url=None, api_version=None
):
"""Construct an API url given a few components, some optional.
Expand All @@ -205,9 +202,9 @@ def build_api_url(
:rtype: str
:returns: The URL assembled from the pieces provided.
"""
url = cls.API_URL_TEMPLATE.format(
api_base_url=(api_base_url or cls.API_BASE_URL),
api_version=(api_version or cls.API_VERSION),
url = self.API_URL_TEMPLATE.format(
api_base_url=(api_base_url or self.API_BASE_URL),
api_version=(api_version or self.API_VERSION),
path=path,
)

Expand Down

0 comments on commit 75a4b66

Please sign in to comment.