Пример #1
0
def get_all_user_info(cursor, user):
    cursor.execute("SELECT * FROM User where email='%s'" % user)
    usr_info = cursor.fetchall()
    if not usr_info:
        return jsonify(code=1, response="No such user")
    all_fetched_followers = get_followers(cursor, user)
    all_fetched_followees = get_followees(cursor, user)
    all_fetched_subscr = get_subscriptions(cursor, user)
    resp = {
        "id": usr_info[0][0],
        "email": usr_info[0][1],
        "about": usr_info[0][2],
        "isAnonymous": true_false_ret(usr_info[0][3]),
        "name": empty_check(usr_info[0][4]),
        "username": empty_check(usr_info[0][5]),
        "followers": all_fetched_followers,
        "following": all_fetched_followees,
        "subscriptions": all_fetched_subscr
    }
    return jsonify(code=0, response=resp)
Пример #2
0
def get_all_user_info(cursor, user):
    cursor.execute("SELECT * FROM User where email='%s'" % user)
    usr_info = cursor.fetchall()
    if not usr_info:
        return jsonify(code=1, response="No such user")
    all_fetched_followers = get_followers(cursor, user)
    all_fetched_followees = get_followees(cursor, user)
    all_fetched_subscr = get_subscriptions(cursor, user)
    resp = {
        "id": usr_info[0][0],
        "email": usr_info[0][1],
        "about": usr_info[0][2],
        "isAnonymous": true_false_ret(usr_info[0][3]),
        "name": empty_check(usr_info[0][4]),
        "username": empty_check(usr_info[0][5]),
        "followers": all_fetched_followers,
        "following": all_fetched_followees,
        "subscriptions": all_fetched_subscr
    }
    return jsonify(code=0, response=resp)
Пример #3
0
def main(argv=None):
    logging.basicConfig(level=LOG_LEVEL, format=LOG_FORMAT)

    if argv is None:
        argv = sys.argv

    parser = init_argparser()
    args = parser.parse_args(argv)

    try:
        config_fname = args.config if args.config \
            else DEFAULT_TWITTER_CONFIG_FNAME
        followers = get_followers(config_fname, args.screen_name)
        print("{0} has {1} followers".format(args.screen_name, len(followers)))
    except:
        trace = traceback.format_exc()
        logging.error("OMGWTFBBQ: {0}".format(trace))
        sys.exit(1)

    # Yayyy-yah
    sys.exit(0)