Skip to content

Commit 0689985

Browse files
committed
fix(url): Change url to service_url
1 parent b274cc6 commit 0689985

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

ibm_cloud_sdk_core/base_service.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class BaseService(object):
3737
SDK_NAME = 'ibm-python-sdk-core'
3838

3939
def __init__(self,
40-
url,
40+
service_url,
4141
authenticator=None,
4242
disable_ssl_verification=False,
4343
display_name=None):
@@ -47,7 +47,7 @@ def __init__(self,
4747
:attr bool disable_ssl_verification: enables/ disables ssl verification
4848
:attr str display_name the name used for mapping services in environment file
4949
"""
50-
self.url = url
50+
self.service_url = service_url
5151
self.http_config = {}
5252
self.jar = CookieJar()
5353
self.authenticator = authenticator
@@ -100,16 +100,16 @@ def set_disable_ssl_verification(self, status=False):
100100
"""
101101
self.disable_ssl_verification = status
102102

103-
def set_url(self, url):
103+
def set_service_url(self, service_url):
104104
"""
105-
Sets the url
105+
Sets the service url
106106
"""
107-
if has_bad_first_or_last_char(url):
107+
if has_bad_first_or_last_char(service_url):
108108
raise ValueError(
109-
'The url shouldn\'t start or end with curly brackets or quotes. '
110-
'Be sure to remove any {} and \" characters surrounding your url'
109+
'The service url shouldn\'t start or end with curly brackets or quotes. '
110+
'Be sure to remove any {} and \" characters surrounding your service url'
111111
)
112-
self.url = url
112+
self.service_url = service_url
113113

114114
def get_authenticator(self):
115115
"""
@@ -164,7 +164,7 @@ def prepare_request(self, method, url, headers=None,
164164
params=None, data=None, files=None, **kwargs):
165165
request = {'method': method}
166166

167-
request['url'] = self.url + url
167+
request['url'] = self.service_url + url
168168

169169
headers = remove_null_values(headers) if headers else {}
170170
headers = cleanup_values(headers)

test/test_base_service.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class AnyServiceV1(BaseService):
1616

1717
def __init__(self,
1818
version,
19-
url=default_url,
19+
service_url=default_url,
2020
authenticator=None,
2121
disable_ssl_verification=False):
2222
BaseService.__init__(
2323
self,
24-
url=url,
24+
service_url=service_url,
2525
authenticator=authenticator,
2626
disable_ssl_verification=disable_ssl_verification,
2727
display_name='Watson')
@@ -162,7 +162,7 @@ def test_iam():
162162
status=200)
163163
responses.add(
164164
responses.GET,
165-
'https://gateway-s.watsonplatform.net/watson/api',
165+
url='https://gateway.watsonplatform.net/test/api',
166166
body=json.dumps({
167167
"foobar": "baz"
168168
}),
@@ -358,13 +358,13 @@ def test_default_headers():
358358
with pytest.raises(TypeError):
359359
service.set_default_headers('xxx')
360360

361-
def test_set_url():
361+
def test_set_service_url():
362362
service = AnyServiceV1('2018-11-20', authenticator=NoAuthAuthenticator())
363363
with pytest.raises(ValueError) as err:
364-
service.set_url('{url}')
365-
assert str(err.value) == 'The url shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your url'
364+
service.set_service_url('{url}')
365+
assert str(err.value) == 'The service url shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your service url'
366366

367-
service.set_url('my_url')
367+
service.set_service_url('my_url')
368368

369369
def test_get_authenticator():
370370
auth = BasicAuthenticator('my_username', 'my_password')

0 commit comments

Comments
 (0)