Ejemplo n.º 1
0
def send(username, password, recipient_list, message):
    """If logged in, sends a message to a list of recipients"""

    session = Session.login(username, password)
    user = User(session=session)
    for recipient in recipient_list:
        user.message(username=recipient, message_text=message)
    
    return "success"
Ejemplo n.º 2
0
def build_copy(source_credentials_or_username, dest_credentials):
    dest_module = importlib.import_module(dest_credentials)
    dest_user = User.from_credentials(dest_module.USERNAME,
                                      dest_module.PASSWORD)
    try:
        source_module = importlib.import_module(source_credentials_or_username)
    except ImportError:
        source = dest_user.get_profile(source_credentials_or_username)
    else:
        source = User.from_credentials(source_module.USERNAME,
                                       source_module.PASSWORD)

    return Copy(source, dest_user)
Ejemplo n.º 3
0
def build_copy(source_credentials_or_username, dest_credentials):
    dest_module = importlib.import_module(dest_credentials)
    dest_user = User.from_credentials(dest_module.USERNAME,
                                      dest_module.PASSWORD)
    try:
        source_module = importlib.import_module(source_credentials_or_username)
    except ImportError:
        source = dest_user.get_profile(source_credentials_or_username)
    else:
        source = User.from_credentials(source_module.USERNAME,
                                       source_module.PASSWORD)

    return Copy(source, dest_user)
Ejemplo n.º 4
0
def make():
    user = User()
    user_model = model.User.from_profile(user.profile)
    user_model.upsert_model(id_key='okc_id')
    okcupyd_user = model.OKCupydUser(user_id=user_model.id)
    okcupyd_user.upsert_model(id_key='user_id')
    return okcupyd_user
Ejemplo n.º 5
0
def send_message(screenname, password, minimum_age, maximum_age, location, radius, gentation, message, num):
    """ If logged in, sends to users on OkCupid that meet given parameters 

    Returns a statement if no users could be found that match the given 
    parameters
    """

    session = Session.login(screenname, password)
    user = User(session=session)
    try:
        for profile in user.search(minimum_age=minimum_age, maximum_age=maximum_age, location=location, radius=radius, gentation=gentation)[:num]:
        # for profile in user.search(minimum_age=minimum_age, maximum_age=maximum_age)[:num]:

           profile.message(message)

    except Exception as e:
        print type(e)
        return "I couldn't find anyone with those specifications"
Ejemplo n.º 6
0
def sync():
    user = User()
    mailbox.Sync(user).all()
    log.info(model.Message.query(model.User.okc_id == user.profile.id))