Code issues (Email external IP address to self via Python) - Raspberry Pi Forums


hey getting error when trying run bit of python when trying extract ip , email myself.
traceback (most recent call last):
file "/home/pi/ipemail/ipemail.py", line 1, in <module>
urllib.request import urlopen
importerror: no module named request

code: select all

 urllib.request import urlopen import re  from_address = '****************@gmail.com' to_address = '*****************@gmail.com' subject = 'rpi ip' username = '******************@gmail.com' password = '***********'  url = 'http://checkip.dyndns.org' print ("our chosen ip address service is: ", url)  request = urlopen(url).read().decode('utf-8') ourip = re.findall("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}",request) ourip = str(ourip) print ("our ip addrerss is: ", ourip) 
or ideas appreciated

this seems python 3 module.
using python 2?


raspberrypi



Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support