Created
January 18, 2017 08:40
-
-
Save rombr/11f9b1346aefe9f5d0e3c51555528cc9 to your computer and use it in GitHub Desktop.
endem.su test task: CLI interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import click | |
from endem import EmailSender | |
@click.command() | |
@click.option('--provider', default='gmail', help='SMTP provider.') | |
@click.option('--email', prompt='Your email', | |
help='The email account to send.') | |
@click.option('--password', prompt='Your password', | |
help='The password for account to send.', | |
hide_input=True) | |
@click.option('--to', prompt='Reciever(s)', | |
help='The Reciever(s) to send.') | |
@click.option('--subject', prompt='Subject', | |
help='The email subject.') | |
@click.option('--message', prompt='Message', | |
help='The message to send.') | |
def main(provider, email, password, to, subject, message): | |
"""Console script for endem""" | |
EmailSender(provider).send(email, password, to, subject, message) | |
click.echo('Message was sent!') | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment