1 --- a/sleekxmpp/xmlstream/resolver.py
2 +++ b/sleekxmpp/xmlstream/resolver.py
3 @@ -175,6 +175,9 @@ def get_A(host, resolver=None, use_dnspy
5 log.debug("DNS: Querying %s for A records." % host)
7 + if isinstance(host, bytes):
8 + host = host.decode("utf-8")
10 # If not using dnspython, attempt lookup using the OS level
11 # getaddrinfo() method.
12 if resolver is None or not use_dnspython:
13 @@ -189,7 +192,10 @@ def get_A(host, resolver=None, use_dnspy
16 recs = resolver.query(host, dns.rdatatype.A)
17 - return [rec.to_text() for rec in recs]
18 + if isinstance(recs[0].to_text(), bytes):
19 + return [rec.to_text().decode("utf-8") for rec in recs]
21 + return [rec.to_text() for rec in recs]
22 except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
23 log.debug("DNS: No A records for %s" % host)
25 @@ -222,6 +228,9 @@ def get_AAAA(host, resolver=None, use_dn
27 log.debug("DNS: Querying %s for AAAA records." % host)
29 + if isinstance(host, bytes):
30 + host = host.decode("utf-8")
32 # If not using dnspython, attempt lookup using the OS level
33 # getaddrinfo() method.
34 if resolver is None or not use_dnspython:
35 @@ -240,7 +249,10 @@ def get_AAAA(host, resolver=None, use_dn
38 recs = resolver.query(host, dns.rdatatype.AAAA)
39 - return [rec.to_text() for rec in recs]
40 + if isinstance(recs[0].to_text(), bytes):
41 + return [rec.to_text().decode("utf-8") for rec in recs]
43 + return [rec.to_text() for rec in recs]
44 except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
45 log.debug("DNS: No AAAA records for %s" % host)
47 @@ -324,6 +336,8 @@ def get_SRV(host, port, service, proto='
48 if running_sum >= selected:
49 rec = sums[running_sum]
50 host = rec.target.to_text()
51 + if isinstance(host, bytes):
52 + host = host.decode("utf-8")
53 if host.endswith('.'):
55 sorted_recs.append((host, rec.port))