Exemplo n.º 1
0
def report_fave_changed():
    ip = request.form['ip']
    fave_was_added = request.form['faveWasAdded']
    if fave_was_added == "true":
        ourUtils.db_quick_query(db_conn, Queries.update_fave_increase, (ip, ))
    else:
        ourUtils.db_quick_query(db_conn, Queries.update_fave_decrease, (ip, ))
    db_conn.commit()
    return 'OK'
Exemplo n.º 2
0
def main():
    if len(sys.argv) != 2:
        print("usage: python " + sys.argv[0] +
              " [ip address to be blacklisted]")
        return
    station_ip = sys.argv[1]
    conn = get_connection()
    ourUtils.db_quick_query(conn, Queries.set_station_blacklisted,
                            (station_ip, ))
    conn.close()
    print("success")
Exemplo n.º 3
0
def main():
    conn = get_connection()
    if conn is None:
        exit("could not connect to db")
    id_url_list = ourUtils.db_quick_query(conn, Queries.get_all_ips)
    ourUtils.multi_thread_runner(id_url_list, worker, conn)
    conn.commit()
    conn.close()
Exemplo n.º 4
0
def get_genre_by_ip():
    ip = request.args.get('ip', '')
    results = ourUtils.db_quick_query(db_conn, Queries.get_our_genre_by_ip,
                                      (ip, ))
    if len(results) == 0:
        abort(400)
    genre_num = constants.genre_names.index(results[0][0])
    return jsonify(genreNum=genre_num)
Exemplo n.º 5
0
def report_timeout():
    ip = request.form['ip']
    ourUtils.db_quick_query(db_conn, Queries.report_timeout, (ip, ))
    db_conn.commit()
    return 'OK'