How to use DNS resolver in Python 3?

Awesome picture Awesome · Jan 2, 2018 · Viewed 15.1k times · Source

I want to check MX-Record from Python. So I installed the dnspython package, but when I try to import following library:

import dns.resolver

It shows the following error:

ModuleNotFoundError: No module named 'dns'.

I use PyCharm and Python 3.

Answer

Alexey picture Alexey · Aug 29, 2018

You should install https://github.com/rthalley/dnspython first

pip install dnspython