Solution 1:

That's because pystun is out of date. pystun does not support recent version of python. Instead, install pystun3

pip uninstall pystun # uninstall already installed pystun module
pip install pystun3
import stun
print(stun.get_ip_info())
#('Symmetric NAT', '111.111.11.111', 1027)

Or, you can get your external IP address, as follows:

import http.client
conn = http.client.HTTPConnection("ifconfig.me")
conn.request("GET", "/ip")
print(conn.getresponse().read())

For more information, see https://ru.stackoverflow.com/questions/133137/

Solution 2:

The original Pystun does not support Python 3. There is a fork that supports Python 3 which you can install using pip install pystun3 (pystun3 on Pypi).