Hi guys I need some help I am following a Guide to feed my cat via email using a raspberry pi here is the link. http://storiknow.com/automatic-cat-feeder-using-raspberry-pi/ seems pretty straight forward but when I get two part two I put in my username and password and get this error below back and im an 100% sure I do not have the wrong username and password. any suggestions?
The Error I am Getting:
Logging in as <siguykittykat>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "GmailWrapper.py", line 15, in __init__
self.login()
File "GmailWrapper.py", line 20, in login
server.login(self.userName, self.password)
File "/usr/local/lib/python2.7/dist-packages/imapclient/imapclient.py", line 284, in login
raise exceptions.LoginError(str(e))
imapclient.exceptions.LoginError: [AUTHENTICATIONFAILED] Invalid credentials (Failure)
>>>
My code for the GmailWrapper.py
#!/usr/bin/env python
from imapclient import IMAPClient, SEEN
SEEN_FLAG = 'SEEN'
UNSEEN_FLAG = 'UNSEEN'
class GmailWrapper:
def __init__(self, host, userName, password):
# force the user to pass along username and password to log in as
self.host = host
self.userName = userName
self.password = password
self.login()
def login(self):
print('Logging in as ' + self.userName)
server = IMAPClient(self.host, use_uid=True, ssl=True)
server.login(self.userName, self.password)
self.server = server
# An Id in this case identifies a specific email
def getIdsBySubject(self, subject, unreadOnly=True, folder='INBOX'):
# search within the specified folder, e.g. Inbox
self.setFolder(folder)
# build the search criteria (e.g. unread emails with the given subject)
self.searchCriteria = [UNSEEN_FLAG, 'SUBJECT', subject]
if(unreadOnly == False):
# force the search to include "read" emails too
self.searchCriteria.append(SEEN_FLAG)
# conduct the search and return the resulting Ids
return self.server.search(self.searchCriteria)
def markAsRead(self, mailIds, folder='INBOX'):
self.setFolder(folder)
self.server.set_flags(mailIds, [SEEN])
def setFolder(self, folder):
self.server.select_folder(folder)