def dislike(sock): """ Deletes likes :param sock: TCP socket :return: None """ like_id = get_num("Enter like id: ") num_dislikes = get_num("Enter num of dislikes: ") print(f"{BLUE}[+] Making {num_dislikes} dislikes{RESET}") make_dislike(sock, like_id, num_dislikes)
def delete_wow(sock): """ Deletes wows :param sock: TCP socket :return: None """ # get data from user wow_id = get_num("Enter first WOW id: ") num_wows = get_num("Enter number of WOWs to delete: ") delete(sock, num_wows, wow_id)
def like_id(sock, user_id): """ Makes like by id :param sock: TCP socket :param user_id: ID of a user :return: None """ num_likes = get_num("Enter number of likes: ") screen_name = get_screen_name() glit_id = get_num("Enter glit id: ") make_like(sock, num_likes, glit_id, user_id, screen_name)
def wow(sock, user_id): """ Makes wows :param sock: TCP socket :param user_id: ID of a user :return: None """ # get data from user glit_id = get_num("Enter glit id: ") user_screen_name = get_screen_name() num_wows = get_num("Enter number of wows: ") print(make_wow(sock, num_wows, user_id, glit_id, user_screen_name))
def like_glit(sock, user_id): """ Makes like by user id :param sock: TCP socket :param user_id: ID of a user :return: None """ data = load_feed(sock, user_id) glit_num = get_num("Enter glit number: ", max_num=len(data[0]['glits'])) glit_id = data[0]['glits'][glit_num - 1]['id'] num_likes = get_num("Enter number of likes: ") screen_name = get_screen_name() make_like(sock, num_likes, glit_id, user_id, screen_name)
def feed_id(sock): """ Loads feed by id :param sock: TCP socket :return: """ # get user id user_id = get_num("Enter user id: ") load_feed(sock, user_id)
def feed_name(sock): """ Loads feed by user screen name :param sock: TCP socket :return: None """ search_data = search(sock) if len(search_data[0]) == 1: print(f"{BLUE}[+] Loading feed for {search_data[0][0]['screen_name']}{RESET}") load_feed(sock, search_data[0][0]['id']) else: user_num = get_num("Enter number of user to load: ", max_num=len(search_data[0])) print(f"{BLUE}[+] Loading feed for {search_data[0][user_num - 1]['screen_name']}{RESET}") load_feed(sock, search_data[0][user_num - 1]['id'])
def load_feed(sock, user_id): """ Loads feed :param sock: TCP socket :param user_id: ID of a user :return: Data from server """ glit_count = get_num("Enter number of glits to load: ") print(f"{BLUE}[+] Loading feeds for user id: {user_id}{RESET}") data = send_feed_request(sock, user_id, glit_count) data = separator(data) print_feed(data) return data
def comment(sock, user_id): """ Posts a comment :param sock: TCP socket :param user_id: ID of a user :return: None """ # get data from user glit_id = get_num("Enter glit id: ") user_screen_name = get_screen_name() content = input("Enter content: ") date = input("Enter date: ") print_comment( separator( send_comment_payload(sock, glit_id, user_id, user_screen_name, content, date)))