コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #11
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #12
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #13
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #14
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #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)
コード例 #16
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #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)
コード例 #18
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #19
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #20
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #21
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #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)
コード例 #23
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #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)
コード例 #25
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #26
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #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)
コード例 #28
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #32
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #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)
コード例 #34
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #35
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #36
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #37
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)
コード例 #38
0
ファイル: yikyakapi.py プロジェクト: akashlevy/Yaklient
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)