summaryrefslogtreecommitdiff
path: root/boto/route53/connection.py
diff options
context:
space:
mode:
Diffstat (limited to 'boto/route53/connection.py')
-rw-r--r--boto/route53/connection.py41
1 files changed, 23 insertions, 18 deletions
diff --git a/boto/route53/connection.py b/boto/route53/connection.py
index 2cab2359..c13ab2e0 100644
--- a/boto/route53/connection.py
+++ b/boto/route53/connection.py
@@ -47,7 +47,7 @@ HZXML = """<?xml version="1.0" encoding="UTF-8"?>
</HostedZoneConfig>
</CreateHostedZoneRequest>"""
-#boto.set_stream_logger('dns')
+# boto.set_stream_logger('dns')
class Route53Connection(AWSAuthConnection):
@@ -65,13 +65,14 @@ class Route53Connection(AWSAuthConnection):
host=DefaultHost, debug=0, security_token=None,
validate_certs=True, https_connection_factory=None,
profile_name=None):
- super(Route53Connection, self).__init__(host,
- aws_access_key_id, aws_secret_access_key,
- True, port, proxy, proxy_port, debug=debug,
- security_token=security_token,
- validate_certs=validate_certs,
- https_connection_factory=https_connection_factory,
- profile_name=profile_name)
+ super(Route53Connection, self).__init__(
+ host,
+ aws_access_key_id, aws_secret_access_key,
+ True, port, proxy, proxy_port, debug=debug,
+ security_token=security_token,
+ validate_certs=validate_certs,
+ https_connection_factory=https_connection_factory,
+ profile_name=profile_name)
def _required_auth_capability(self):
return ['route53']
@@ -84,9 +85,9 @@ class Route53Connection(AWSAuthConnection):
continue
pairs.append(key + '=' + urllib.parse.quote(str(val)))
path += '?' + '&'.join(pairs)
- return super(Route53Connection, self).make_request(action, path,
- headers, data,
- retry_handler=self._retry_handler)
+ return super(Route53Connection, self).make_request(
+ action, path, headers, data,
+ retry_handler=self._retry_handler)
# Hosted Zones
@@ -103,7 +104,7 @@ class Route53Connection(AWSAuthConnection):
if start_marker:
params = {'marker': start_marker}
response = self.make_request('GET', '/%s/hostedzone' % self.Version,
- params=params)
+ params=params)
body = response.read()
boto.log.debug(body)
if response.status >= 300:
@@ -157,7 +158,7 @@ class Route53Connection(AWSAuthConnection):
hosted_zone_name += '.'
all_hosted_zones = self.get_all_hosted_zones()
for zone in all_hosted_zones['ListHostedZonesResponse']['HostedZones']:
- #check that they gave us the FQDN for their zone
+ # check that they gave us the FQDN for their zone
if zone['Name'] == hosted_zone_name:
return self.get_hosted_zone(zone['Id'].split('/')[-1])
@@ -233,7 +234,6 @@ class Route53Connection(AWSAuthConnection):
h.parse(body)
return e
-
# Health checks
POSTHCXMLBody = """<CreateHealthCheckRequest xmlns="%(xmlns)s">
@@ -327,7 +327,6 @@ class Route53Connection(AWSAuthConnection):
h.parse(body)
return e
-
# Resource Record Sets
def get_all_rrsets(self, hosted_zone_id, type=None,
@@ -383,7 +382,7 @@ class Route53Connection(AWSAuthConnection):
"""
params = {'type': type, 'name': name,
- 'Identifier': identifier, 'maxitems': maxitems}
+ 'identifier': identifier, 'maxitems': maxitems}
uri = '/%s/hostedzone/%s/rrset' % (self.Version, hosted_zone_id)
response = self.make_request('GET', uri, params=params)
body = response.read()
@@ -522,12 +521,18 @@ class Route53Connection(AWSAuthConnection):
if response.status == 400:
code = response.getheader('Code')
- if code and 'PriorRequestNotComplete' in code:
+ if code:
# This is a case where we need to ignore a 400 error, as
# Route53 returns this. See
# http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html
+ if 'PriorRequestNotComplete' in code:
+ error = 'PriorRequestNotComplete'
+ elif 'Throttling' in code:
+ error = 'Throttling'
+ else:
+ return status
msg = "%s, retry attempt %s" % (
- 'PriorRequestNotComplete',
+ error,
i
)
next_sleep = min(random.random() * (2 ** i),