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
or ideas appreciated
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)
this seems python 3 module.
using python 2?
using python 2?
raspberrypi
Comments
Post a Comment