I'm getting the following error on my script for conky.

"Traceback (most recent call last):
  File "/home/troll/.gmail/gmail.py", line 1, in <module>
    import urllib.request
ImportError: No module named request"

code below:

import urllib.request
from xml.etree import ElementTree as etree

# Enter your username and password below within quotes below, in place of
****.
# Set up authentication for gmail
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm='New mail feed',
                          url='https://mail.google.com/',
                          user= 'username',
                          passwd= 'gmail')
opener = urllib.request.build_opener(auth_handler)
# ...and install it globally so it can be used with urlopen.
urllib.request.install_opener(opener)

gmail = 'https://mail.google.com/gmail/feed/atom'
NS = '{http://purl.org/atom/ns#}'
with urllib.request.urlopen('https://mail.google.com/gmail/feed/atom') as
source:
    tree = etree.parse(source)
fullcount = tree.find(NS + 'fullcount').text
print(fullcount + ' new')
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to