Example #1
0
def yaks(user, location):
    """Return raw response data for messages at location using user"""
    params = [("accuracy", user.location.accuracy), ("lat", location.latitude),
              ("long", location.longitude), ("token", get_token()),
              ("userID", user.user_id), ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "yaks", params)
Example #2
0
def save_basecamp(user, name, location):
    """Return raw response data from saving a basecamp"""
    params = [("token", get_token()), ("userID", user.user_id)]
    data = [("bcLat", location.latitude), ("bcLong", location.longitude),
            ("bcName", name), ("bcPeekId", 0)]
    return _send("POST", settings.BASECAMP_ENDPOINT, "saveBasecamp", params,
                 data)
Example #3
0
def get_message(user, message_id):
    """Return raw response data for a message (ID: message_id) using user"""
    params = [("accuracy", user.location.accuracy), ("messageID", message_id),
              ("token", get_token()), ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getMessage", params)
Example #4
0
def get_area_tops(user):
    """Return raw response data for top Yaks in area"""
    params = [("lat", user.location.latitude),
              ("long", user.location.longitude), ("token", get_token()),
              ("userID", user.user_id), ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getAreaTops", params)
Example #5
0
def get_basecamps(user):
    """Return raw response data for all basecamps of user"""
    params = [("lat", user.location.latitude),
              ("long", user.location.longitude), ("token", get_token()),
              ("userID", user.user_id), ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.BASECAMP_ENDPOINT, "getBasecamps", params)
Example #6
0
def like_comment(user, comment_id, basecamp=0):
    """Return raw response data from upvoting a comment (ID: comment_id) using
    user (optionally at basecamp)"""
    params = [("accuracy", user.location.accuracy), ("bc", int(basecamp)),
              ("commentID", comment_id), ("token", get_token()),
              ("userID", user.user_id), ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "likeComment", params)
Example #7
0
def downvote_message(user, message_id, basecamp=0):
    """Return raw response data from downvoting a message (ID: message_id)
    using user (optionally at basecamp)"""
    params = [("accuracy", user.location.accuracy), ("bc", int(basecamp)),
              ("messageID", message_id), ("token", get_token()),
              ("userID", user.user_id), ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "downvoteMessage", params)
Example #8
0
def get_my_recent_replies(user):
    """Return raw response data for recent replies of user"""
    params = [("accuracy", user.location.accuracy),
              ("lat", user.location.latitude),
              ("long", user.location.longitude), ("token", get_token()),
              ("userID", user.user_id), ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getMyRecentReplies", params)
Example #9
0
def log_event(user, event_type):
    """Return raw response data from logging an app event of type event_type
    using user"""
    params = [("accuracy", user.location.accuracy), ("token", get_token()),
              ("userID", user.user_id), ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    data = [("eventType", event_type), ("lat", user.location.latitude),
            ("long", user.location.longitude)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "logEvent", params, data)
Example #10
0
def contact_us(user, message, category, email):
    """Return raw response data from contacting Yik Yak with message in
    particular category using user with specified email"""
    params = [("token", get_token()),
              ("userID", user.user_id)]
    data = [("category", category),
            ("email", email),
            ("message", message)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "contactUs", params, data)
Example #11
0
def contact_us(user, message, category, email):
    """Return raw response data from contacting Yik Yak with message in
    particular category using user with specified email"""
    params = [("token", get_token()),
              ("userID", user.user_id)]
    data = [("category", category),
            ("email", email),
            ("message", message)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "contactUs", params, data)
Example #12
0
def get_area_tops(user):
    """Return raw response data for top Yaks in area"""
    params = [("lat", user.location.latitude),
              ("long", user.location.longitude),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getAreaTops", params)
Example #13
0
def get_basecamps(user):
    """Return raw response data for all basecamps of user"""
    params = [("lat", user.location.latitude),
              ("long", user.location.longitude),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.BASECAMP_ENDPOINT, "getBasecamps", params)
Example #14
0
def get_message(user, message_id):
    """Return raw response data for a message (ID: message_id) using user"""
    params = [("accuracy", user.location.accuracy),
              ("messageID", message_id),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getMessage", params)
Example #15
0
def register_user(user):
    """Return raw response data from registering user"""
    params = [("accuracy", user.location.accuracy),
              ("deviceID", generate_id(dashes=False, upper=True)),
              ("lat", user.location.latitude),
              ("long", user.location.longitude), ("token", get_token()),
              ("userID", user.user_id), ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "registerUser", params)
Example #16
0
def yaks(user, location):
    """Return raw response data for messages at location using user"""
    params = [("accuracy", user.location.accuracy),
              ("lat", location.latitude),
              ("long", location.longitude),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "yaks", params)
Example #17
0
def get_peek_messages(user, peek_id):
    """Return raw response data for messages at peek location (ID: peek_id)
    using user"""
    params = [("accuracy", user.location.accuracy),
              ("lat", user.location.latitude),
              ("long", user.location.longitude), ("peekID", peek_id),
              ("token", get_token()), ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getPeekMessages", params)
Example #18
0
def save_basecamp(user, name, location):
    """Return raw response data from saving a basecamp"""
    params = [("token", get_token()),
              ("userID", user.user_id)]
    data = [("bcLat", location.latitude),
            ("bcLong", location.longitude),
            ("bcName", name),
            ("bcPeekId", 0)]
    return _send("POST", settings.BASECAMP_ENDPOINT, "saveBasecamp", params,
                 data)
Example #19
0
def get_my_recent_replies(user):
    """Return raw response data for recent replies of user"""
    params = [("accuracy", user.location.accuracy),
              ("lat", user.location.latitude),
              ("long", user.location.longitude),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getMyRecentReplies", params)
Example #20
0
def downvote_message(user, message_id, basecamp=0):
    """Return raw response data from downvoting a message (ID: message_id)
    using user (optionally at basecamp)"""
    params = [("accuracy", user.location.accuracy),
              ("bc", int(basecamp)),
              ("messageID", message_id),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "downvoteMessage", params)
Example #21
0
def register_user(user):
    """Return raw response data from registering user"""
    params = [("accuracy", user.location.accuracy),
              ("deviceID", generate_id(dashes=False, upper=True)),
              ("lat", user.location.latitude),
              ("long", user.location.longitude),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "registerUser", params)
Example #22
0
def hot(user, location, basecamp=0):
    """Return raw response data for top messages in location/basecamp using
    user"""
    if basecamp:
        location = user.basecamp_location
    params = [("accuracy", user.location.accuracy), ("bc", int(basecamp)),
              ("lat", location.latitude), ("long", location.longitude),
              ("token", get_token()), ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "hot", params)
Example #23
0
def like_comment(user, comment_id, basecamp=0):
    """Return raw response data from upvoting a comment (ID: comment_id) using
    user (optionally at basecamp)"""
    params = [("accuracy", user.location.accuracy),
              ("bc", int(basecamp)),
              ("commentID", comment_id),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "likeComment", params)
Example #24
0
def submit_peek_message(user, message, peek_id, handle=None, btp=0):
    """Return raw response data from submitting a peek message with an optional
    handle at peek location with ID peek_id using user (optionally with
    parameter bypassedThreatPopup as btp)"""
    params = [("token", get_token()), ("userID", user.user_id)]
    data = [("bypassedThreatPopup", int(btp)), ("lat", user.location.latitude),
            ("long", user.location.longitude), ("message", message),
            ("peekID", peek_id)]
    if handle:
        data += [("hndl", handle)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "submitPeekMessage", params,
                 data)
Example #25
0
def get_peek_messages(user, peek_id):
    """Return raw response data for messages at peek location (ID: peek_id)
    using user"""
    params = [("accuracy", user.location.accuracy),
              ("lat", user.location.latitude),
              ("long", user.location.longitude),
              ("peekID", peek_id),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getPeekMessages", params)
Example #26
0
def log_event(user, event_type):
    """Return raw response data from logging an app event of type event_type
    using user"""
    params = [("accuracy", user.location.accuracy),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    data = [("eventType", event_type),
            ("lat", user.location.latitude),
            ("long", user.location.longitude)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "logEvent", params, data)
Example #27
0
def get_comments(user, message_id, basecamp=0):
    """Return raw response data for all comments on a message (ID: message_id)
    using user (optionally at basecamp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("accuracy", user.location.accuracy), ("bc", int(basecamp)),
              ("lat", location.latitude), ("long", location.longitude),
              ("messageID", message_id), ("token", get_token()),
              ("userID", user.user_id), ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getComments", params)
Example #28
0
def hot(user, location, basecamp=0):
    """Return raw response data for top messages in location/basecamp using
    user"""
    if basecamp:
        location = user.basecamp_location
    params = [("accuracy", user.location.accuracy),
              ("bc", int(basecamp)),
              ("lat", location.latitude),
              ("long", location.longitude),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "hot", params)
Example #29
0
def report_message(user, message_id, reason, basecamp=0):
    """Return raw response data from reporting a message (ID: message_id) for a
    specified reason using user (optionally at basecamp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("accuracy", user.location.accuracy), ("bc", int(basecamp)),
              ("lat", location.latitude), ("long", location.longitude),
              ("messageID", message_id), ("reason", reason),
              ("token", get_token()), ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "reportMessage", params)
Example #30
0
def send_message(user, message, handle=None, btp=0, basecamp=0):
    """Return raw response data from sending a message with an optional handle
    using user (optionally at basecamp and optionally with parameter
    bypassedThreatPopup as btp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("bc", int(basecamp)), ("token", get_token()),
              ("userID", user.user_id)]
    data = [("bypassedThreatPopup", int(btp)), ("lat", location.latitude),
            ("long", location.longitude), ("message", message)]
    if handle:
        data += [("hndl", handle)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "sendMessage", params, data)
Example #31
0
def delete_comment(user, comment_id, message_id, basecamp=0):
    """Return raw response data from deleting a comment (ID: comment_id)
    belonging to a message (ID: message_id) with user (optionally at
    basecamp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("accuracy", user.location.accuracy), ("bc", int(basecamp)),
              ("commentID", comment_id), ("lat", location.latitude),
              ("long", location.longitude), ("messageID", message_id),
              ("token", get_token()), ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "deleteComment", params)
Example #32
0
def submit_peek_message(user, message, peek_id, handle=None, btp=0):
    """Return raw response data from submitting a peek message with an optional
    handle at peek location with ID peek_id using user (optionally with
    parameter bypassedThreatPopup as btp)"""
    params = [("token", get_token()),
              ("userID", user.user_id)]
    data = [("bypassedThreatPopup", int(btp)),
            ("lat", user.location.latitude),
            ("long", user.location.longitude),
            ("message", message),
            ("peekID", peek_id)]
    if handle:
        data += [("hndl", handle)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "submitPeekMessage",
                 params, data)
Example #33
0
def post_comment(user, comment, message_id, btp=0, basecamp=0):
    """Return raw response data from posting a comment belonging to message
    (ID: message_id) using user (optionally at basecamp and optionally with
    parameter bypassedThreatPopup as btp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("accuracy", user.location.accuracy), ("bc", int(basecamp)),
              ("token", get_token()), ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    data = [("bypassedThreatPopup", int(btp)), ("comment", comment),
            ("lat", location.latitude), ("long", location.longitude),
            ("messageID", message_id)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "postComment", params, data)
Example #34
0
def get_comments(user, message_id, basecamp=0):
    """Return raw response data for all comments on a message (ID: message_id)
    using user (optionally at basecamp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("accuracy", user.location.accuracy),
              ("bc", int(basecamp)),
              ("lat", location.latitude),
              ("long", location.longitude),
              ("messageID", message_id),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "getComments", params)
Example #35
0
def report_message(user, message_id, reason, basecamp=0):
    """Return raw response data from reporting a message (ID: message_id) for a
    specified reason using user (optionally at basecamp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("accuracy", user.location.accuracy),
              ("bc", int(basecamp)),
              ("lat", location.latitude),
              ("long", location.longitude),
              ("messageID", message_id),
              ("reason", reason),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "reportMessage", params)
Example #36
0
def send_message(user, message, handle=None, btp=0, basecamp=0):
    """Return raw response data from sending a message with an optional handle
    using user (optionally at basecamp and optionally with parameter
    bypassedThreatPopup as btp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("bc", int(basecamp)),
              ("token", get_token()),
              ("userID", user.user_id)]
    data = [("bypassedThreatPopup", int(btp)),
            ("lat", location.latitude),
            ("long", location.longitude),
            ("message", message)]
    if handle:
        data += [("hndl", handle)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "sendMessage", params, data)
Example #37
0
def delete_comment(user, comment_id, message_id, basecamp=0):
    """Return raw response data from deleting a comment (ID: comment_id)
    belonging to a message (ID: message_id) with user (optionally at
    basecamp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("accuracy", user.location.accuracy),
              ("bc", int(basecamp)),
              ("commentID", comment_id),
              ("lat", location.latitude),
              ("long", location.longitude),
              ("messageID", message_id),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    return _send("GET", settings.YIKYAK_ENDPOINT, "deleteComment", params)
Example #38
0
def post_comment(user, comment, message_id, btp=0, basecamp=0):
    """Return raw response data from posting a comment belonging to message
    (ID: message_id) using user (optionally at basecamp and optionally with
    parameter bypassedThreatPopup as btp)"""
    if basecamp:
        location = user.basecamp_location
    else:
        location = user.location
    params = [("accuracy", user.location.accuracy),
              ("bc", int(basecamp)),
              ("token", get_token()),
              ("userID", user.user_id),
              ("userLat", user.location.latitude),
              ("userLong", user.location.longitude)]
    data = [("bypassedThreatPopup", int(btp)),
            ("comment", comment),
            ("lat", location.latitude),
            ("long", location.longitude),
            ("messageID", message_id)]
    return _send("POST", settings.YIKYAK_ENDPOINT, "postComment", params, data)