boto/botocore — pull request #163 by jamesls (2013-10-22 05:42:37+00:00)
Title: Specifying endpoint_url should not require metadata dict

If a service has no metadata dict that contains
regions/endpoint/protocol info, we should still be able to
construct endpoints by passing endpoint_url. I've also
updated the code to not require region_name unless it's a sigv4
service (which is the only reason we need to require a region name
if we're given an explicit endpoint_url).

With this commit, we can consume the unprocessed model as it
exists in services/*.json.

So basically:

```
>>> botocore.session.get_session()

>>> s = _
>>> s.get_service('iam')
Service(iam)
>>> service = _
>>> service.get_endpoint()
iam(https://iam.amazonaws.com/)
>>> service.get_endpoint(region_name='us-east-1')
iam(https://iam.amazonaws.com/)
>>> service.get_endpoint(region_name='us-east-1', endpoint_url='https://example.com')
iam(https://example.com)
>>> service.get_endpoint(endpoint_url='https://example.com') # sigv4 services requires explicit region_name when using endpoint_url
Traceback (most recent call last):
File "", line 1, in
File "botocore/service.py", line 124, in get_endpoint
return get_endpoint(self, region_name, endpoint_url)
File "botocore/endpoint.py", line 257, in get_endpoint
service_object=service)
File "botocore/endpoint.py", line 272, in _get_auth
raise botocore.exceptions.NoRegionError(env_var=envvar_name)
botocore.exceptions.NoRegionError: You must specify a region or set the BOTO_DEFAULT_REGION environment variable.
>>> s.get_service('ec2').get_endpoint(endpoint_url='http://complete.override.com') # sigv2 service doesn't require region_name when using endpoint_url
ec2(http://complete.override.com)
```