summaryrefslogtreecommitdiff
path: root/boto
diff options
context:
space:
mode:
authorFelix Yan <felixonmars@gmail.com>2014-08-28 11:12:49 +0800
committerFelix Yan <felixonmars@gmail.com>2014-08-28 11:12:49 +0800
commit7281e13f404536098dc7e85937dc569d347dd5c8 (patch)
tree9781a822babc6d0f41dc6b9fee215d27c5d58dda /boto
parentac2b311c04cb49b337ba033b1a550039c12c929d (diff)
downloadboto-7281e13f404536098dc7e85937dc569d347dd5c8.tar.gz
route53 module: tidy up to meet PEP8 better
Diffstat (limited to 'boto')
-rw-r--r--boto/route53/connection.py29
-rw-r--r--boto/route53/exception.py4
-rw-r--r--boto/route53/healthcheck.py2
-rw-r--r--boto/route53/hostedzone.py2
-rw-r--r--boto/route53/record.py55
-rw-r--r--boto/route53/zone.py2
6 files changed, 46 insertions, 48 deletions
diff --git a/boto/route53/connection.py b/boto/route53/connection.py
index 2cab2359..c33b67d8 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,
diff --git a/boto/route53/exception.py b/boto/route53/exception.py
index ba41285a..61b33b0c 100644
--- a/boto/route53/exception.py
+++ b/boto/route53/exception.py
@@ -15,13 +15,13 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from boto.exception import BotoServerError
-class DNSServerError(BotoServerError):
+class DNSServerError(BotoServerError):
pass
diff --git a/boto/route53/healthcheck.py b/boto/route53/healthcheck.py
index 85d6919b..43fdf179 100644
--- a/boto/route53/healthcheck.py
+++ b/boto/route53/healthcheck.py
@@ -141,6 +141,6 @@ class HealthCheck(object):
params['ip_addr_part'] = self.XMLIpAddrPart % {'ip_addr': self.ip_addr}
if self.string_match is not None:
- params['string_match_part'] = self.XMLStringMatchPart % {'string_match' : self.string_match}
+ params['string_match_part'] = self.XMLStringMatchPart % {'string_match': self.string_match}
return self.POSTXMLBody % params
diff --git a/boto/route53/hostedzone.py b/boto/route53/hostedzone.py
index 66b79b84..fd8420c4 100644
--- a/boto/route53/hostedzone.py
+++ b/boto/route53/hostedzone.py
@@ -22,6 +22,7 @@
# IN THE SOFTWARE.
#
+
class HostedZone(object):
def __init__(self, id=None, name=None, owner=None, version=None,
@@ -53,4 +54,3 @@ class HostedZone(object):
self.caller_reference = value
else:
setattr(self, name, value)
-
diff --git a/boto/route53/record.py b/boto/route53/record.py
index 664739b8..d5848e5f 100644
--- a/boto/route53/record.py
+++ b/boto/route53/record.py
@@ -25,6 +25,8 @@
RECORD_TYPES = ['A', 'AAAA', 'TXT', 'CNAME', 'MX', 'PTR', 'SRV', 'SPF']
from boto.resultset import ResultSet
+
+
class ResourceRecordSets(ResultSet):
"""
A list of resource records.
@@ -65,9 +67,9 @@ class ResourceRecordSets(ResultSet):
record_list)
def add_change(self, action, name, type, ttl=600,
- alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,
- weight=None, region=None, alias_evaluate_target_health=None,
- health_check=None, failover=None):
+ alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,
+ weight=None, region=None, alias_evaluate_target_health=None,
+ health_check=None, failover=None):
"""
Add a change request to the set.
@@ -121,10 +123,10 @@ class ResourceRecordSets(ResultSet):
for the latency-based routing
:type alias_evaluate_target_health: Boolean
- :param alias_evaluate_target_health: *Required for alias resource record sets* Indicates
- whether this Resource Record Set should respect the health status of
- any health checks associated with the ALIAS target record which it is
- linked to.
+ :param alias_evaluate_target_health: *Required for alias resource record
+ sets* Indicates whether this Resource Record Set should respect the
+ health status of any health checks associated with the ALIAS target
+ record which it is linked to.
:type health_check: str
:param health_check: Health check to associate with this record
@@ -134,11 +136,11 @@ class ResourceRecordSets(ResultSet):
primary or secondary resource record set.
"""
change = Record(name, type, ttl,
- alias_hosted_zone_id=alias_hosted_zone_id,
- alias_dns_name=alias_dns_name, identifier=identifier,
- weight=weight, region=region,
- alias_evaluate_target_health=alias_evaluate_target_health,
- health_check=health_check, failover=failover)
+ alias_hosted_zone_id=alias_hosted_zone_id,
+ alias_dns_name=alias_dns_name, identifier=identifier,
+ weight=weight, region=region,
+ alias_evaluate_target_health=alias_evaluate_target_health,
+ health_check=health_check, failover=failover)
self.changes.append([action, change])
return change
@@ -189,8 +191,6 @@ class ResourceRecordSets(ResultSet):
self.is_truncated = truncated
-
-
class Record(object):
"""An individual ResourceRecordSet"""
@@ -237,11 +237,10 @@ class Record(object):
EvaluateTargetHealth = """<EvaluateTargetHealth>%s</EvaluateTargetHealth>"""
-
def __init__(self, name=None, type=None, ttl=600, resource_records=None,
- alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,
- weight=None, region=None, alias_evaluate_target_health=None,
- health_check=None, failover=None):
+ alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,
+ weight=None, region=None, alias_evaluate_target_health=None,
+ health_check=None, failover=None):
self.name = name
self.type = type
self.ttl = ttl
@@ -280,9 +279,9 @@ class Record(object):
else:
eval_target_health = ""
- body = self.AliasBody % { "hosted_zone_id": self.alias_hosted_zone_id,
- "dns_name": self.alias_dns_name,
- "eval_target_health": eval_target_health }
+ body = self.AliasBody % {"hosted_zone_id": self.alias_hosted_zone_id,
+ "dns_name": self.alias_dns_name,
+ "eval_target_health": eval_target_health}
else:
# Use resource record(s)
records = ""
@@ -298,14 +297,14 @@ class Record(object):
weight = ""
if self.identifier is not None and self.weight is not None:
- weight = self.WRRBody % {"identifier": self.identifier, "weight":
- self.weight}
+ weight = self.WRRBody % {"identifier": self.identifier,
+ "weight": self.weight}
elif self.identifier is not None and self.region is not None:
- weight = self.RRRBody % {"identifier": self.identifier, "region":
- self.region}
+ weight = self.RRRBody % {"identifier": self.identifier,
+ "region": self.region}
elif self.identifier is not None and self.failover is not None:
- weight = self.FailoverBody % {"identifier": self.identifier, "failover":
- self.failover}
+ weight = self.FailoverBody % {"identifier": self.identifier,
+ "failover": self.failover}
health_check = ""
if self.health_check is not None:
@@ -329,7 +328,7 @@ class Record(object):
rr += ' (EvalTarget %s)' % self.alias_evaluate_target_health
else:
# Show resource record(s)
- rr = ",".join(self.resource_records)
+ rr = ",".join(self.resource_records)
if self.identifier is not None and self.weight is not None:
rr += ' (WRR id=%s, w=%s)' % (self.identifier, self.weight)
diff --git a/boto/route53/zone.py b/boto/route53/zone.py
index bb6907da..167a0891 100644
--- a/boto/route53/zone.py
+++ b/boto/route53/zone.py
@@ -60,7 +60,7 @@ class Zone(object):
return response['ChangeResourceRecordSetsResponse']['ChangeInfo']
def _new_record(self, changes, resource_type, name, value, ttl, identifier,
- comment=""):
+ comment=""):
"""
Add a CREATE change record to an existing ResourceRecordSets