Exemplo n.º 1
0
def main():

    mailAddress = pyinputplus.inputEmail("Enter email address: \n")
    pw = pyinputplus.inputPassword("Enter password for sending the mail: \n",
                                   timeout=10)
    mailMessage = pyinputplus.inputStr("Enter message to send: \n")
    send_mail(mailAddress, pw, mailMessage)
Exemplo n.º 2
0
def main():
    email = pyip.inputEmail('Enter email address: ')
    #passwd = pyip.inputPassword(prompt='Enter account password: '******'x')
    passwd = input('Enter account password: '******'Enter email message: \n')

    emailer(passwd, email, message)
def setconfig():
    config.read("settings.ini")
    curn = config.sections()

    while True:
        cname = input("What would you like to name this configuration?\n")
        if cname in curn:
            print("That name is already taken")
            continue
        break

    fn = input("What is your first name?\n")
    ln = input("What is your last name?\n")
    fullname = fn + " " + ln
    emailc = pyip.inputEmail("What is your email address?\n")
    autosubmit = pyip.inputYesNo(
        "Would like to have the form automatically submitted?\n")
    config[cname] = {
        "First Name": fn,
        "Last Name": ln,
        "Fullname": fullname,
        "Email": emailc,
        "Auto Submit": autosubmit,
    }
    with open("settings.ini", "w") as configfile:
        config.write(configfile)
Exemplo n.º 4
0
def create_user_data():
    username = pyip.inputStr(prompt='Username: '******'First Name: ')
    last_name = pyip.inputStr(prompt='Last Name: ')
    age = pyip.inputInt(prompt='Age: ', min=1, max=99)
    email = pyip.inputEmail(prompt='Email: ', )
    country = pyip.inputStr(prompt='Country: ')
    join_date = get_date()
    return username, first_name, last_name, age, email, country, join_date
Exemplo n.º 5
0
def get_user_email(cfg: git.GitConfigParser) -> str:
    '''
    Returns the user email specified in the .gitconfig file

        Parameters:
            cfg (git.GitConfigparser): A config parser object pointing at the user's .gitconfig file

        Returns:
            email (str): The user's email address
    '''
    try:
        return cfg.get_value('user', 'email')
    except configparser.NoSectionError or configparser.NoOptionError:
        print('WARNING: Git user email not set.')
        return pyip.inputEmail(prompt='Please enter your email: ')
Exemplo n.º 6
0
def getAssignees():
    numAssignees = 0
    while True:
        addNew = pyip.inputYesNo('Do you wish to add a new person? (y/n)\n')
        if addNew == 'yes':
            assigneeName = pyip.inputStr('What\'s their name?\n')
            assigneeEmail = pyip.inputEmail('What\'s their email?\n')
            assignees[assigneeName] = {
                'email': assigneeEmail,
                'currentChore': '',
                'lastChore': ''
            }
            numAssignees += 1
        elif addNew == 'no':
            if not numAssignees > 0:
                print('You must add at least one assignee')
                continue
            break
    def open_account():
        """This account collect user inputs for opening new account.
        
        Collect User inputs, store that in a list and pass it to the backend
        open account. if the result from the backend is true it restart the 
        program again and if the result if false it call the open_account() 
        method again to collect user information again.

        Return: None
        """
        print("\n")
        print(messages.open_account)
        u_id = pyip.inputInt("Id: ", greaterThan=0)
        name = pyip.inputCustom(raiseNameError, prompt="Name: ")
        address = pyip.inputCustom(raiseAddressError, prompt="Address: ")
        email = pyip.inputEmail("Email: ")
        balance = pyip.inputInt("Balance: ", min=0)
        password = pyip.inputPassword("Password: ")

        user_data = [u_id, name, address, balance, email, password]
        result = BankOperationsBackend.open_account(user_data)

        start_again() if result else BankOperationsUi.open_account()
def prompt():
    # Ask user for their email and password
    global sender
    global sender_pass
    sender = pyip.inputEmail(prompt="Please enter your email:\n")
    sender_pass = pyip.inputPassword(prompt="Enter your password:\n", mask="*")
Exemplo n.º 9
0
print("\n######### Validate inputNum() ########")
print(pyip.inputNum("\nEnter a number: "))

print("\n######### Validate inputDate() ########")
print(pyip.inputDate("\nEnter a date : "))

print("\n######### Validate inputYesNo() ########")
print(pyip.inputYesNo("\nDo you like Python? (y/n): "))

print("\n######### Validate inputChoice() ########")
fruits = ['apple', 'banana', 'orange']
print("\nYour choice:", pyip.inputChoice(fruits))

print("\n######### Validate inputMenu() ########")
print("\nYour fruit:", pyip.inputMenu(fruits, numbered=True))

# Demonstrate the following PyInputPlus keyword arguments
print("\n######### Keyword arguments min, max ########")
print(pyip.inputInt("\nEnter a number (min=70, max=100): ", min=70, max=100))

print("\n######### Keyword arguments greaterThan, lessThan ########")
print(pyip.inputNum("\nEnter a number (3<num<5):  ", lessThan=5, greaterThan=3))

print("\n######### Keyword arguments limit, timeout, default ########")
print(pyip.inputEmail("\nEnter your email1(limit=3): ", limit=3, default='\nFailed Input!'))
print(pyip.inputEmail("\nEnter your email2(timeout=10): ", timeout=10, default='\nTime Out!'))

print("\n######### Keyword arguments allowRegexes and block Regexes ########")
print(pyip.inputNum("\nEnter a positive number: ", blockRegexes=[r'-[\d]']))
print(pyip.inputNum("\nEnter a number with spaces: ", allowRegexes=[r'\s']))
#!/usr/bin/env python3
# send_dues_reminder - Sends email based on payment status in spreadsheet.

import getpass, openpyxl, smtplib, sys

import pyinputplus as pyip

my_email = pyip.inputEmail('Enter your email address: ')   
pwd = getpass.getpass()

# Open spreadsheet and get the latest dues status.

wb = openpyxl.load_workbook('duesRecords.xlsx')
sheet = wb.get_sheet_by_name('Sheet1')
last_col = sheet.max_column
lastest_month = sheet.cell(row=1, column=last_col).value

# Check each member's payment status.
unpaid_members = {}
for r in range(2, sheet.max_row + 1):
    payment = sheet.cell(row=r, column=last_col).value
    if payment != 'paid':
        name = sheet.cell(row=r, column=1).value
        email = sheet.cell(row=r, column=2).value
        unpaid_members[name] = email

# Log in to email account
smtp_obj = smtplib.SMTP('smtp.gmail.com', 587)
smtp_obj.ehlo()
smtp_obj.starttls()
smtp_obj.login(my_email, pwd)
# Instalar biblioteca
# pip install pyinputplus

from pyinputplus import inputNum, inputURL, inputEmail

# Aceita uma string
email = inputEmail(prompt='Digite seu email: ')
# Digite seu email: [email protected]

# Aceita apenas uma string no formato de url, retornando a string
url = inputURL(prompt='Digite uma url: ')
# Digite uma url: erickson.com.br

# Aceita apenas um número inteiro, Retornando um int, não um str.
num = inputNum(prompt='Digite um número: ')
# Digite um número: 369

# OUTROS TESTES
# MENU
# variavel = inputMenu(['Cachorro', 'Gato', 'Boi'])
# variavel = inputMenu(['Cachorro', 'Gato', 'Boi'], numbered=True)
# variavel = inputMenu(['Cachorro', 'Gato', 'Boi'], lettered=True)

# NUMERO
# variavel = inputNum('Digite um número: ')
# variavel = inputNum('Digite um número: ', max=9)

# CHOICES
# variavel = inputChoice(['1', '2'])
# try:
#     variavel = inputChoice(['1', '2'], limit=2)
#!/usr/bin/env python3
# command_line_emailer.py - Logs into email and sends string of text to email provided

import pyinputplus as pyip
import getpass, time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

email = pyip.inputEmail(
    'Enter your email address: ')  # Prompt user for their email address
pwd = getpass.getpass()

# Open and log into gmail
browser = webdriver.Firefox()
browser.get(
    'https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin'
)
user_elem = browser.find_element_by_id(
    'identifierId')  # Specific to Gmail. Change for other emails
user_elem.send_keys(email)

# Find and click 'Next' button. Class name specific to Gmail
next_elem = browser.find_element_by_class_name('VfPpkd-RLmnJb')
next_elem.click()

time.sleep(1)  # Wait before looking for password element
pwd_elem = browser.find_element_by_name('password')
pwd_elem.send_keys(pwd)

# Find and click 'Next' button. Class name specific to Gmail
next_elem = browser.find_element_by_class_name('VfPpkd-RLmnJb')
Exemplo n.º 13
0
#!/usr/bin/python3
#     ____  _____ ______
#    / __ \/ ___// ____/	Python script by Dennis Chaves
#   / / / /\__ \/ /    		github.com/ismashbuttons
#  / /_/ /___/ / /___  		[email protected]
# /_____//____/\____/
#
# emailSlicer
# Collect an email address from the user and then find out if the user has a
# custom domain name or a popular domain name.

import pyinputplus, re

emailRgx = re.compile(r'([\w.-_+\*]*)(@)(\w*.com)')

popularEmailDomains = [
    'gmail.com', 'outlook.com', 'yahoo.com', 'aol.com', 'yandex.com',
    'protonmail.com', 'zohomail.com'
]

userEmail = pyinputplus.inputEmail(prompt="Please enter your email address: ")

match = emailRgx.match(userEmail)
if match[3] in popularEmailDomains:
    print(
        "Hi %s, your email is registered with %s. That's a really popular email provider!"
        % (match[1], match[3]))
else:
    print("Hi %s, your email is registered with %s. That's a unique domain!" %
          (match[1], match[3]))
Exemplo n.º 14
0
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import pyinputplus as pyip
from time import sleep
import sys

if len(sys.argv) in range(2, 4):
    creds = sys.argv[1]
    with open(creds, 'r') as f:
        content = f.read()

    email, passwd, *_ = content.split('\n')
else:
    email = pyip.inputEmail('\nE-mail: ')
    passwd = pyip.inputPassword('Password: '******'r') as f:
        content = f.read()
    to_email, subject, *body_lines = content.split('\n')
else:
    to_email = pyip.input('\nTo E-mail: ')
    subject = input('Subject: ')

    print('Body (content) (Ctrl + C to finish):')
    while True:
        try:
            body_lines += [input()]
        except KeyboardInterrupt:
Exemplo n.º 15
0
#! python3

import pyinputplus as pyip

num = pyip.inputNum()
string = pyip.inputStr()
mail = pyip.inputEmail()
yesNo = pyip.inputYesNo()
password = pyip.inputPassword()
Exemplo n.º 16
0
import pyinputplus as pyip

menu = ['red', 'blue', 'yellow']
# s = pyip.inputNum('请输入数字:')
# print(s)
# user_input = pyip.inputMenu(menu)
# print(user_input)

user_input = pyip.inputChoice(menu)
print(user_input)

user_email = pyip.inputEmail('请输入email')
print(user_email)
Exemplo n.º 17
0
    imap_obj.login(email, password)
    imap_obj.select_folder('INBOX', readonly=True)
    unique_ids = imap_obj.search(['ALL'])

    links_to_unsubscribe_from = []

    for unique_id in unique_ids:
        raw_message = imap_obj.fetch([unique_id], ['BODY[]', 'FLAGS'])
        message = pyzmail.PyzMessage.factory(raw_message[unique_id][b'BODY[]'])
        if message.html_part is None:
            continue
        message_html = message.html_part.get_payload().decode(message.html_part.charset)
        soup = bs4.BeautifulSoup(message_html, 'html.parser')
        link_elems = soup.select('a')
        for element in link_elems:
            if 'unsubscribe' in str(element).lower():
                links_to_unsubscribe_from.append(element.get('href'))

    imap_obj.logout()

    for link in links_to_unsubscribe_from:
        print(f'Opening {link}...')
        webbrowser.open(link)


if __name__ == '__main__':
    input_email = pyip.inputEmail(prompt='Please enter the email address:\n')
    input_password = pyip.inputStr(prompt='Please enter your email password:\n')

    open_unsubscribe_links(input_email, input_password)
Exemplo n.º 18
0
            By.XPATH,
            "/html/body/div[7]/div[3]/div/div[2]/div[1]/div[1]/div[1]/div/div/div/div[1]/div/div"
        )))
finally:
    composeElem = driver.find_element_by_xpath(
        "/html/body/div[7]/div[3]/div/div[2]/div[1]/div[1]/div[1]/div/div/div/div[1]/div/div"
    )
    composeElem.click()

try:
    # wait for new message box to appear
    WebDriverWait(driver,
                  10).until(EC.presence_of_element_located((By.NAME, "to")))
finally:
    toElem = driver.find_element_by_name("to")
    toEmail = pyip.inputEmail("Enter recipient's email:\n")
    toElem.send_keys(toEmail)

    subjectElem = driver.find_element_by_name("subjectbox")
    subject = pyip.inputStr("Enter subject:\n")
    subjectElem.send_keys(subject)

    textboxElem = nextElem(subjectElem)
    message = pyperclip.paste(
    )  # will send active clipboard; replace with input if you want to send something else
    textboxElem.send_keys(message)

    sendElem = nextElem(textboxElem)
    sendElem.send_keys(Keys.ENTER)

# driver.quit()
Exemplo n.º 19
0
        try:
            if book in READ_BOOKS:
                browser.find_element_by_class_name('wtrShelfButton').click()
                add_to_shelf_elem = browser.find_element_by_class_name(
                    action_elem)
                add_to_shelf_elem.click()
            else:
                add_to_shelf_elem = browser.find_element_by_class_name(
                    action_elem)
                add_to_shelf_elem.submit()
        except Exception as exc:
            print('There was a problem: %s' % (exc))


if __name__ == '__main__':
    print('Input email', end=': ')
    username = pyip.inputEmail()
    print('Input password', end=': ')
    pw = pyip.inputPassword()

    with webdriver.Chrome() as browser:
        wait = ui.WebDriverWait(browser, 10)
        browser.get('https://www.goodreads.com/')
        sign_in(browser, username, pw)

        if len(WANT_TO_READ_BOOKS) > 0:
            add_books_to_shelf(browser, WANT_TO_READ_BOOKS, 'wtrToRead')

        if len(READ_BOOKS) > 0:
            add_books_to_shelf(browser, READ_BOOKS, 'wtrExclusiveShelf')
# A program that tells user which company registred their email address
# More popular company can/should be added
# by Aminu ahmadh
# GITHUB @AminuAhmadh

import pyinputplus as pyip

name = input("Hey, what's your name\n")
email = pyip.inputEmail(prompt=f"ok {name}, what's your email address:\n")
if email.endswith('gmail.com'):
    print(
        f'i see that your email address is registred with Google, {name}. that was great'
    )
elif email.endswith('yahoo.com'):
    print(
        f'i see that your email address is registred wit yahoo, {name}. that was great'
    )
else:
    print(
        f'i see that you have a custom email address, {name}. that was fantastic'
    )
def email_chores(chores, email_addresses, login_email, login_password):
    smtp_obj = smtplib.SMTP('smtp.gmail.com', 587)
    smtp_obj.ehlo()
    smtp_obj.starttls()
    smtp_obj.login(login_email, login_password)

    for email_address in email_addresses:
        random_chore = random.choice(chores)
        chores.remove(random_chore)
        print(f'Sending chore {random_chore} to the email {email_address}...')
        smtp_obj.sendmail(
            login_email, email_address,
            'Subject: Your Chore\n\nHello,\nHere is your chore: ' +
            random_chore)
    smtp_obj.quit()


if __name__ == '__main__':
    chores_string = pyip.inputStr(
        prompt='Please enter a comma-separated list of chores:\n')
    email_addresses_string = pyip.inputStr(
        prompt='Please enter a comma-separated list of emails:\n')
    email = pyip.inputEmail(
        prompt='Please enter the email address to use to send the chores:\n')
    password = pyip.inputStr(prompt='Please enter your email password:\n')

    chores_list = chores_string.split(',')
    email_addresses_list = email_addresses_string.split(',')
    email_chores(chores_list, email_addresses_list, email, password)
Exemplo n.º 22
0
cursor = sqlconnection.cursor()
# uncomment this to execute and create table for the first time
# sqlconnection.execute(table)
# print('Created table successfully')
sqlconnection.commit()

print('Welcome to pluto. Your all in One fantasies.')
print("Please login or sign up to begin ")
print()

prompt = pyinputplus.inputChoice(['Login', 'Sign up'], prompt="Enter 'Login' to login (for existing users) or 'Sign up' to create a new account if you're a new user: "******"Enter your full name: \n")
    username = input("Enter your username: \n")
    email = pyinputplus.inputEmail("Enter your email: \n")
    password = input("Enter password: "******"Enter your phone: \n")
    country = input("Enter you country: \n")
    gender = pyinputplus.inputChoice(['M', 'F'], "Enter gender 'M' for male and 'F' for female: \n")
    dataTuple = (name, username, email, password, phone, country, gender)
    query = "insert into LoginSystem (fullname, username, email, password, phone, country, gender) values(?,?,?,?,?,?,?) "
    cursor.execute(query, (dataTuple))
    sqlconnection.commit()
    print("Signed up successfully")

elif prompt == 'login':
    email = pyinputplus.inputEmail("Enter your email: \n")
    password = input("Enter your password: \n")
    dataTuple = (email)
    data = [(email, password)]
Exemplo n.º 23
0
#!/bin/python3

import pyinputplus as pyin

name = pyin.inputStr("Enter a name: ")

print(name)

number = pyin.inputNum("Enter a number: ")

print(number)

are_you_old = pyin.inputYesNo("Are you old? ")

print(are_you_old)

email = pyin.inputEmail("Enter an email address: ")

print(email)

password = pyin.inputPassword("Enter a password: "******"Premium", "Pro", "Basic"])

print(membership)
Exemplo n.º 24
0
wb = openpyxl.load_workbook('duesRecords.xlsx')
sheet = wb['Sheet1']
last_col = sheet.max_column
latest_month = sheet.cell(row=1, column=last_col).value

# Check each member's payment status.
unpaid_members = {}
for r in range(2, sheet.max_row + 1):
    payment = sheet.cell(row=r, column=last_col).value
    if payment != 'paid':
        name = sheet.cell(row=r, column=1).value
        email = sheet.cell(row=r, column=2).value
        unpaid_members[name] = email

# Log in to email account.
email = pyip.inputEmail(prompt='Please enter your gmail email address:\n')
password = pyip.inputStr(prompt='Please enter your email password:\n')
smtp_obj = smtplib.SMTP('smtp.gmail.com', 587)
smtp_obj.ehlo()
smtp_obj.starttls()
smtp_obj.login(email, password)

# Send out reminder emails.
for name, email in unpaid_members.items():
    body = f"Subject: {latest_month} dues unpaid.\nDear {name},\nRecords show that you have not " \
           f"paid dues for {latest_month}. Please make this payment as soon as possible. Thank you!"
    print('Sending email to %s...' % email)
    send_mail_status = smtp_obj.sendmail('*****@*****.**', email,
                                         body)

    if send_mail_status != {}:
Exemplo n.º 25
0
#! python3

# cmdEmail - sends an email from the users gmail account

#       Inputs:     Recipient email, message and when selenium reaches gmail login it prompts the user to put it in into the command line

from selenium import webdriver

from selenium.webdriver.common.keys import Keys

import pyinputplus as pyip

import sys, time

receiver = pyip.inputEmail(prompt="Please put in mail of recipient: ")

message = pyip.inputStr(prompt="What would you like to send?")

driver = webdriver.Firefox(
    executable_path=
    r"C:\Users\alene\Downloads\geckodriver-v0.28.0-win64\geckodriver.exe")

driver.get('https://medium.com/')

btnSign = driver.find_element_by_link_text('Sign In')

btnSign.click()

btnSign = driver.find_element_by_link_text('Sign in with Google')

btnSign.click()
Exemplo n.º 26
0
import maya
import pyinputplus as pypi

user_name = pypi.inputStr("Enter your name please: ")

user_email = pypi.inputEmail("Enter your email please: ").lower()

password = pypi.inputPassword(
    """\n Your email password is needed for authentication with GMAIL. \n
Enter your email password: """)
name_input = pypi.inputStr(
    "Enter the name of the person you wish to send the email: ")
email_input = pypi.inputEmail("Enter his/her email as well: ").lower()
subject = pypi.inputStr("What is the Title of your email? \n")


#date_sent = pypi.inputDatetime(" WHen do you want to send teh email? ")
def send_msg():
    welcome_message = pypi.inputStr('''Enter your message: \n
        ''')
    print(maya.now())
    return welcome_message