diff options
author | Lance Stout <lancestout@gmail.com> | 2011-08-18 02:46:48 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-08-18 02:46:48 -0700 |
commit | 3e51126e18f4943a825b31c34fa11d8c37982332 (patch) | |
tree | 632a06c792ecfb1f117387acf69b49a1c3a8261b /sleekxmpp/clientxmpp.py | |
parent | a714fa82b25506df4511e956b1b0cf5f67475e53 (diff) | |
download | slixmpp-3e51126e18f4943a825b31c34fa11d8c37982332.tar.gz slixmpp-3e51126e18f4943a825b31c34fa11d8c37982332.tar.bz2 slixmpp-3e51126e18f4943a825b31c34fa11d8c37982332.tar.xz slixmpp-3e51126e18f4943a825b31c34fa11d8c37982332.zip |
PEP8 edits
Diffstat (limited to 'sleekxmpp/clientxmpp.py')
-rw-r--r-- | sleekxmpp/clientxmpp.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py index 170b35f0..004037f2 100644 --- a/sleekxmpp/clientxmpp.py +++ b/sleekxmpp/clientxmpp.py @@ -143,7 +143,7 @@ class ClientXMPP(BaseXMPP): def get_dns_records(self, domain, port=None): """ Get the DNS records for a domain. - Overridden XMLStream.get_dns_records to use SRV. + Overriddes XMLStream.get_dns_records to use SRV. Arguments: domain -- The domain in question. @@ -153,16 +153,22 @@ class ClientXMPP(BaseXMPP): port = self.default_port if DNSPYTHON: try: - answers = [((answer.target.to_text()[:-1], answer.port), answer.priority, answer.weight) for answer in dns.resolver.query("_xmpp-client._tcp.%s" % domain, dns.rdatatype.SRV)] + record = "_xmpp-client._tcp.%s" % domain + answers = [] + for answer in dns.resolver.query(record, dns.rdatatype.SRV): + address = (answer.target.to_text()[:-1], answer.port) + answers.append((address, answer.priority, answer.weight)) except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): log.warning("No SRV records for %s" % domain) answers = super(ClientXMPP, self).get_dns_records(domain, port) except dns.exception.Timeout: - log.warning("DNS resolution timed out for SRV record of %s" % domain) + log.warning("DNS resolution timed out " + \ + "for SRV record of %s" % domain) answers = super(ClientXMPP, self).get_dns_records(domain, port) return answers else: - log.warning("dnspython is not installed -- relying on OS A record resolution") + log.warning("dnspython is not installed -- " + \ + "relying on OS A record resolution") return [((domain, port), 0, 0)] def register_feature(self, name, handler, restart=False, order=5000): |