saghul / aiodns

Simple DNS resolver for asyncio

Home Page:https://pypi.python.org/pypi/aiodns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

lphuberdeau opened this issue · comments

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.

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.