aio-libs / aiodns

Simple DNS resolver for asyncio
https://pypi.python.org/pypi/aiodns
MIT License
538 stars 69 forks source link

TypeError: a bytes-like object is required, not 'str' #33

Closed lphuberdeau closed 7 years ago

lphuberdeau commented 7 years ago

Following a change in pycares, the TXT records are now provided as byte strings. The change appears to be intentional.

This results in a behavior change for aiodns depending on if the library is using 2.2.0 or 2.3.0. I would expect the .text property to always return a string.

saghul commented 7 years ago

Yes, it was intentional. The reason being that there are many TXT records out there with invalid UTF-8 characters in there, so we cannot make a string out of them. So, from 2.3.0 onwards, TXT records will always be bytes.