Skip to content

Commit

Permalink
Add verify arg to get_endpoint in Service object
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesls committed Jan 9, 2014
1 parent 4142e03 commit 824d36d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions botocore/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _build_endpoint_url(self, host, is_secure):
return endpoint_url

def get_endpoint(self, region_name=None, is_secure=True,
endpoint_url=None):
endpoint_url=None, verify=None):
"""
Return the Endpoint object for this service in a particular
region.
Expand Down Expand Up @@ -127,7 +127,7 @@ def get_endpoint(self, region_name=None, is_secure=True,
# Before getting into any of the region/endpoint
# logic, if an endpoint_url is explicitly
# provided, just use what's been explicitly passed in.
return self._get_endpoint(region_name, endpoint_url)
return self._get_endpoint(region_name, endpoint_url, verify)
if region_name is None and not self.global_endpoint:
# The only time it's ok to *not* provide a region is
# if the service is a global_endpoint (e.g. IAM).
Expand Down Expand Up @@ -163,14 +163,14 @@ def get_endpoint(self, region_name=None, is_secure=True,
# endpoint_prefix.region.amazonaws.com.
host = '%s.%s.amazonaws.com' % (self.endpoint_prefix, region_name)
endpoint_url = self._build_endpoint_url(host, is_secure)
return self._get_endpoint(region_name, endpoint_url)
return self._get_endpoint(region_name, endpoint_url, verify)

def _get_endpoint(self, region_name, endpoint_url):
def _get_endpoint(self, region_name, endpoint_url, verify):
event = self.session.create_event('creating-endpoint',
self.endpoint_prefix)
self.session.emit(event, service=self, region_name=region_name,
endpoint_url=endpoint_url)
return get_endpoint(self, region_name, endpoint_url)
return get_endpoint(self, region_name, endpoint_url, verify)

def get_operation(self, operation_name):
"""
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def test_get_endpoint_with_no_region(self):
endpoint = service.get_endpoint()
self.assertEqual(endpoint.host, 'https://iam.amazonaws.com/')

def test_get_endpoint_forwards_verify_args(self):
service = self.session.get_service('iam')
endpoint = service.get_endpoint(verify='/path/cacerts.pem')
self.assertEqual(endpoint.verify, '/path/cacerts.pem')

def test_endpoint_arg_overrides_everything(self):
service = self.session.get_service('iam')
endpoint = service.get_endpoint(
Expand Down

0 comments on commit 824d36d

Please sign in to comment.