def check_imap(imap_account): if imap_account["useSSL"] == "true": client = imaplib.IMAP4_SSL(imap_account["host"], int(imap_account["port"])) else: client = imaplib.IMAP4(imap_account["host"], int(imap_account["port"])) client.login(imap_account["login"], imap_account["password"]) client.select() return len(client.search(None, 'UNSEEN')[1][0].split())
from oauth2client import tools # Discord Client client = discord.Client() env = os.environ.get("WemadeitEnv") pswd = "" usnm = "" if env == "production": pswd = os.environ.get("password") usnm = os.environ.get("username") else: with open("cred.json") as f: creds = json.load(f) usnm = creds['user'] pswd = creds['pass'] client.login(usnm, pswd) # Chatterbot Client chatbot = ChatBot("BlackWhitby", logic_adapter="chatterbot.adapters.logic.ClosestMatchAdapter") chatbot.train("chatterbot.corpus.english") chatbot.train("chatterbot.corpus.english.greetings") chatbot.train("chatterbot.corpus.english.conversations") # Todo add corpus for swearing swearing = {} with open("corpus/swearing.json") as f: swearing = json.load(f) if "f**k" in swearing.keys(): for line in swearing["f**k"]: chatbot.train(line) # Drive API
def test_user_authentication(self): client = APIClient() res = client.login(username='******', password='******') print res