Exemplo n.º 1
0
def send(name, website=None, verbose=False):
    if website is not None:
        msg = format_msg(my_name=name, my_website=website)
    else:
        msg = format_msg(my_name=name)
    if verbose is True:
        print(name, website)
        print(msg)
    r = requests.get('http://httpbin.org/json')
    if r.status_code == 200:
        return r.json()
    else:
        return 'There was an error.'
Exemplo n.º 2
0
def send(name, website=None, verbose=False):
    if website != None:
        msg = format_msg(my_name=name, my_website=website)
    else:
        msg = format_msg(my_name=name)
    if verbose:
        print(name, website)
    #send the message
    r = requests.get('http://httpbin.org/json')
    if r.status_code == 200:
        return r.json()
    else:
        return "Ther was an error!!!"
Exemplo n.º 3
0
def send(name, website=None, verbose=True):
    if website != None:
        msg = format_msg(name, website)
    else:
        msg = format_msg(name)

    if verbose == True:
        print(name, website)

    r = requests.get("http://httpbin.org/json")
    if r.status_code == 200:
        return r.json()
    else:
        "There was an error"
Exemplo n.º 4
0
def send(name, website=None, verbose=False, to_email=None):
    if website != None:
        msg = format_msg(my_name=name, my_website=website)
    else:
        msg = format_msg(my_name=name)
    if verbose:
        print(name, website)
    #send the message
    try:
        send_mail(text=msg, to_emails=[to_email], html=None)
        sent = True
    except:
        sent = False
    return sent
Exemplo n.º 5
0
def send(name, website=None, versbose=False):
    if website != None:
        msg = format_msg(my_name=name, my_website=website)
    else:
        msg = format_msg(my_name=name)
    if versbose:
        print(name, website)

    #send message
    r = requests.get("http://httpbin.org/json")
    if r.status_code == 200:
        return r.json()
    else:
        print("There was a error")
Exemplo n.º 6
0
def send(name, website=None, to_email=None):
    assert to_email != None
    msg = None
    if website != None:
        msg = format_msg(my_name=name, my_website=website)
    else:
        msg = format_msg(my_name=name)
    #now,we have the formatted message,lets send it
    sent = True
    try:
        send_mail(text=msg, to_emails=[to_email])
    except:
        sent = False
    return sent
Exemplo n.º 7
0
def send(name, website=None, to_email=None, verbose=False):
    assert to_email != None
    if website != None:
        msg = format_msg(name=name, website=website)
    else:
        msg = format_msg(name=name)
    if verbose:
        print(name, website, to_email)
    # send message
    try:
        send_email(text=msg, to_emails=[to_email], html=None)
        sent = True
    except:
        sent = False
    return sent
Exemplo n.º 8
0
def send(name, website=None, verbose=False):
    #Using imported local module
    if website != None:
        message = format_msg(name=name, website=website)
    else:
        message = format_msg(name=name)
    if verbose:
        print(name, website)

    #Using imported external module
    r = requests.get("http://httpbin.org/json")
    if r.status_code == 200:
        return r.json()
    else:
        return 'There was an error'
Exemplo n.º 9
0
def send(name, website=None, to_email=None, verbose=False):
    assert to_email != None
    if website != None:
        msg = format_msg(myname=name, mywebsite=website)
    else:
        msg = format_msg(myname=name)
    if verbose:
        print(name, website, to_email)
    #send mail
    try:
        send_mail(text=msg, to_emails=[to_email], subject="test", html=None)
        send = True
    except:
        send = False

    return send
Exemplo n.º 10
0
def send(name, website):
    msg = format_msg(myname=name, mywebsite=website)
    r = requests.get("http://httpbin.org/json")
    print(r.status_code)
    if r.status_code == 200:
        return r.json()
    else:
        return "there was an error"
Exemplo n.º 11
0
def send(name, website=None, to_email=None, verbose=False):

    assert to_email is not None

    if website is not None:
        msg = format_msg(my_name=name, my_website=website)
    else:
        msg = format_msg(my_name=name)

    if verbose:
        print(name, website, to_email)
    try:
        send_mail(text=msg, to_emails=[to_email], html=None)
        sent = True
    except:
        sent = False
    return sent
Exemplo n.º 12
0
def send(name: str, website: str = None, verbose: bool = False):
    """
    Send formatted message.
    """
    if website is not None:
        msg = format_msg(name=name, website=website)
    else:
        msg = format_msg(name=name)

    if verbose:
        print(name, website)
    # Send the message
    response = requests.get("http://httpbin.org/json")

    if response.status_code == 200:
        return response.json()
    else:
        return "There was an error!"
Exemplo n.º 13
0
def send(name, website=None, verbose=False, to_email=None):
    # Throw an error if to_email is empty
    assert to_email != None

    #Using imported local module
    if website != None:
        message = format_msg(name=name, website=website)
    else:
        message = format_msg(name=name)
    if verbose:
        print(name, website, email)

    #Send message with sendmail module
    try:
        sendmail(text=message, to_emails=[to_email], html=None)
        sent = True
    except:
        sent = False

    return sent
Exemplo n.º 14
0
def send(name: str,
         website: str = None,
         to_email: str = None,
         verbose: bool = False):
    """
    Send formatted message.
    """
    assert to_email is not None

    if website is not None:
        msg = format_msg(name=name, website=website)
    else:
        msg = format_msg(name=name)

    if verbose:
        print(name, website, to_email)

    # Try sending the message
    try:
        send_mail(text=msg, to_emails=[to_email], html=None)
        sent = True
    except:
        sent = False
    return f"Message sent? {sent}"
Exemplo n.º 15
0
def send(name, website=None, to_email=None, verbose=False):
    assert to_email != None

    msg = format_msg(name=name, website=website)
    r = requests.get("http://httpbin.org/json")

    if verbose:
        print(name, website, to_email)

    if r.status_code == 200:
        print(r.json())
    else:
        return "There was an error"

    try:
        send_mail(text=msg, to_emails=[to_email], html=None)
        sent = True
    except:
        sent = False

    return sent
Exemplo n.º 16
0
def send(name):
    msg = format_msg(name)
    return msg