bson expects strings to be valid utf-8 but the output of whois isn't necessarily in any particular encoding, or at least it won't tell you what encoding it was in if it did know.
This caused an exception to be raised:
bson.errors.InvalidStringData: strings in documents must be valid UTF-8
I tried coercing the output of whois to bytes but that did not solve the problem.
bson expects strings to be valid utf-8 but the output of whois isn't necessarily in any particular encoding, or at least it won't tell you what encoding it was in if it did know.
This caused an exception to be raised:
bson.errors.InvalidStringData: strings in documents must be valid UTF-8
I tried coercing the output of whois to bytes but that did not solve the problem.