Esempio n. 1
0
def get_userinfo( request, username ):
    user_dict = show_userinfo( username )
    email = user_dict["email"]
    tel = user_dict["tel"]
    token = user_dict["token"]
    token_expiration = user_dict["token_expiration"]
    service_count_dict = serviceUsed( token )
    print 'service_count_dict:', service_count_dict
    if service_count_dict != {}:
        senti_count_weibo = service_count_dict['senti_count_weibo']
        senti_weibo_total_count = service_count_dict['senti_weibo_total_count']
        senti_count_auto = service_count_dict['senti_count_auto']
        senti_auto_total_count = service_count_dict['senti_auto_total_count']
        senti_count_news = service_count_dict['senti_count_news']
        senti_news_total_count = service_count_dict['senti_news_total_count']
        senti_count_finance = service_count_dict['senti_count_finance']
        senti_finance_total_count = service_count_dict['senti_finance_total_count']

        keywords_count = service_count_dict['keywords_count']
        keywords_total_count = service_count_dict['keywords_total_count']
        item_label_count = service_count_dict['item_label_count']
        item_label_total_count = service_count_dict['item_label_total_count']
        media_label_count = service_count_dict['media_label_count']
        media_label_total_count = service_count_dict['media_label_total_count']
        auto_summary_count = service_count_dict['auto_summary_count']
        auto_summary_total_count = service_count_dict['auto_summary_total_count']
        reputation_get_result_count = service_count_dict['reputation_get_result_count']
        reputation_get_result_total_count = service_count_dict['reputation_get_result_total_count']
        # print 'auto_summary_count',auto_summary_count
        return render( request, 'user.html', {"username":username, "email":email, "tel":tel, "token":token, "token_expiration":token_expiration, "senti_count_weibo":senti_count_weibo, "senti_count_auto":senti_count_auto, "senti_count_news":senti_count_news, "senti_count_finance":senti_count_finance, "keywords_count":keywords_count, "item_label_count":item_label_count, "media_label_count":media_label_count, "auto_summary_count":auto_summary_count, "reputation_get_result_count":reputation_get_result_count, "senti_weibo_total_count":senti_weibo_total_count, "senti_auto_total_count":senti_auto_total_count, "senti_news_total_count":senti_news_total_count, "senti_finance_total_count":senti_finance_total_count, "keywords_total_count":keywords_total_count, "item_label_total_count":item_label_total_count, "media_label_total_count":media_label_total_count, "auto_summary_total_count":auto_summary_total_count, "reputation_get_result_total_count":reputation_get_result_total_count} )
Esempio n. 2
0
def show_user( request ):
    username = request.session.get( 'username', None )
#     if request.method == "POST":
#         if username is None:
#             return HttpResponseRedirect( '/' )
#         else:
#             print "POST username:"******"new tel:", user_tel
#                 if user_tel is not None:
#                     update_tel( username, user_tel )
#             user_dict = show_userinfo( username )
#             email = user_dict["email"]
#             tel = user_dict["tel"]
#             token = user_dict["token"]
#             token_expiration = user_dict["token_expiration"]
#             service_count_dict = serviceUsed( token )
#             print 'service_count_dict:', service_count_dict
#             if service_count_dict != {}:
#                 senti_count_weibo = service_count_dict['senti_count_weibo']
#                 senti_weibo_total_count = service_count_dict['senti_weibo_total_count']
#                 senti_count_auto = service_count_dict['senti_count_auto']
#                 senti_auto_total_count = service_count_dict['senti_auto_total_count']
#                 senti_count_news = service_count_dict['senti_count_news']
#                 senti_news_total_count = service_count_dict['senti_news_total_count']
#                 senti_count_finance = service_count_dict['senti_count_finance']
#                 senti_finance_total_count = service_count_dict['senti_finance_total_count']
#                 keywords_count = service_count_dict['keywords_count']
#                 keywords_total_count = service_count_dict['keywords_total_count']
#                 item_label_count = service_count_dict['item_label_count']
#                 item_label_total_count = service_count_dict['item_label_total_count']
#                 media_label_count = service_count_dict['media_label_count']
#                 media_label_total_count = service_count_dict['media_label_total_count']
#                 auto_summary_count = service_count_dict['auto_summary_count']
#                 auto_summary_total_count = service_count_dict['auto_summary_total_count']
#                 reputation_get_result_count = service_count_dict['reputation_get_result_count']
#                 reputation_get_result_total_count = service_count_dict['reputation_get_result_total_count']
# 
#                 senti_weibo_rest_count = int( senti_weibo_total_count ) - int( senti_count_weibo )
#                 senti_auto_rest_count = int( senti_auto_total_count ) - int( senti_count_auto )
#                 senti_news_rest_count = int( senti_news_total_count ) - int( senti_count_news )
#                 senti_finance_rest_count = int( senti_finance_total_count ) - int( senti_count_finance )
#                 keywords_rest_count = int( keywords_total_count ) - int( keywords_count )
#                 item_label_rest_count = int( item_label_total_count ) - int( item_label_count )
#                 media_label_rest_count = int( media_label_total_count ) - int( media_label_count )
#                 auto_summary_rest_count = int( auto_summary_total_count ) - int( auto_summary_count )
#                 reputation_get_result_rest_count = int( reputation_get_result_total_count ) - int( reputation_get_result_count )
#                 return render( request, 'user.html', {"username":username, "email":email, "tel":tel, "token":token, "token_expiration":token_expiration, "senti_count_weibo":senti_count_weibo, "senti_count_auto":senti_count_auto, "senti_count_news":senti_count_news, "senti_count_finance":senti_count_finance, "keywords_count":keywords_count, "item_label_count":item_label_count, "media_label_count":media_label_count, "auto_summary_count":auto_summary_count, "reputation_get_result_count":reputation_get_result_count, "senti_weibo_total_count":senti_weibo_total_count, "senti_auto_total_count":senti_auto_total_count, "senti_news_total_count":senti_news_total_count, "senti_finance_total_count":senti_finance_total_count, "keywords_total_count":keywords_total_count, "item_label_total_count":item_label_total_count, "media_label_total_count":media_label_total_count, "auto_summary_total_count":auto_summary_total_count, "reputation_get_result_total_count":reputation_get_result_total_count, "senti_weibo_rest_count":senti_weibo_rest_count, "senti_auto_rest_count":senti_auto_rest_count, "senti_news_rest_count":senti_news_rest_count, "senti_finance_rest_count":senti_finance_rest_count, "keywords_rest_count":keywords_rest_count, "item_label_rest_count":item_label_rest_count, "media_label_rest_count":media_label_rest_count, "auto_summary_rest_count":auto_summary_rest_count, "reputation_get_result_rest_count":reputation_get_result_rest_count} )
#     else:

    if username is None:
        return render( request, 'index.html' )
    else:
        user_dict = show_userinfo( username )
        email = user_dict["email"]
        tel = user_dict["tel"]
        token = user_dict["token"]
        token_expiration = user_dict["token_expiration"]
        service_count_dict = serviceUsed( token )
        print 'service_count_dict:', service_count_dict
        if service_count_dict != {}:
            senti_count_weibo = service_count_dict['senti_count_weibo']
            senti_weibo_total_count = service_count_dict['senti_weibo_total_count']
            senti_count_auto = service_count_dict['senti_count_auto']
            senti_auto_total_count = service_count_dict['senti_auto_total_count']
            senti_count_news = service_count_dict['senti_count_news']
            senti_news_total_count = service_count_dict['senti_news_total_count']
            senti_count_finance = service_count_dict['senti_count_finance']
            senti_finance_total_count = service_count_dict['senti_finance_total_count']
            keywords_count = service_count_dict['keywords_count']
            keywords_total_count = service_count_dict['keywords_total_count']
            item_label_count = service_count_dict['item_label_count']
            item_label_total_count = service_count_dict['item_label_total_count']
            media_label_count = service_count_dict['media_label_count']
            media_label_total_count = service_count_dict['media_label_total_count']
            auto_summary_count = service_count_dict['auto_summary_count']
            auto_summary_total_count = service_count_dict['auto_summary_total_count']
            reputation_get_result_count = service_count_dict['reputation_get_result_count']
            reputation_get_result_total_count = service_count_dict['reputation_get_result_total_count']

            senti_weibo_rest_count = int( senti_weibo_total_count ) - int( senti_count_weibo )
            senti_auto_rest_count = int( senti_auto_total_count ) - int( senti_count_auto )
            senti_news_rest_count = int( senti_news_total_count ) - int( senti_count_news )
            senti_finance_rest_count = int( senti_finance_total_count ) - int( senti_count_finance )
            keywords_rest_count = int( keywords_total_count ) - int( keywords_count )
            item_label_rest_count = int( item_label_total_count ) - int( item_label_count )
            media_label_rest_count = int( media_label_total_count ) - int( media_label_count )
            auto_summary_rest_count = int( auto_summary_total_count ) - int( auto_summary_count )
            reputation_get_result_rest_count = int( reputation_get_result_total_count ) - int( reputation_get_result_count )
            return render( request, 'user.html', {"username":username, "email":email, "tel":tel, "token":token, "token_expiration":token_expiration, "senti_count_weibo":senti_count_weibo, "senti_count_auto":senti_count_auto, "senti_count_news":senti_count_news, "senti_count_finance":senti_count_finance, "keywords_count":keywords_count, "item_label_count":item_label_count, "media_label_count":media_label_count, "auto_summary_count":auto_summary_count, "reputation_get_result_count":reputation_get_result_count, "senti_weibo_total_count":senti_weibo_total_count, "senti_auto_total_count":senti_auto_total_count, "senti_news_total_count":senti_news_total_count, "senti_finance_total_count":senti_finance_total_count, "keywords_total_count":keywords_total_count, "item_label_total_count":item_label_total_count, "media_label_total_count":media_label_total_count, "auto_summary_total_count":auto_summary_total_count, "reputation_get_result_total_count":reputation_get_result_total_count, "senti_weibo_rest_count":senti_weibo_rest_count, "senti_auto_rest_count":senti_auto_rest_count, "senti_news_rest_count":senti_news_rest_count, "senti_finance_rest_count":senti_finance_rest_count, "keywords_rest_count":keywords_rest_count, "item_label_rest_count":item_label_rest_count, "media_label_rest_count":media_label_rest_count, "auto_summary_rest_count":auto_summary_rest_count, "reputation_get_result_rest_count":reputation_get_result_rest_count} )
Esempio n. 3
0
def show_user(request):
    username = request.session.get('username', None)
    #     if request.method == "POST":
    #         if username is None:
    #             return HttpResponseRedirect( '/' )
    #         else:
    #             print "POST username:"******"new tel:", user_tel
    #                 if user_tel is not None:
    #                     update_tel( username, user_tel )
    #             user_dict = show_userinfo( username )
    #             email = user_dict["email"]
    #             tel = user_dict["tel"]
    #             token = user_dict["token"]
    #             token_expiration = user_dict["token_expiration"]
    #             service_count_dict = serviceUsed( token )
    #             print 'service_count_dict:', service_count_dict
    #             if service_count_dict != {}:
    #                 senti_count_weibo = service_count_dict['senti_count_weibo']
    #                 senti_weibo_total_count = service_count_dict['senti_weibo_total_count']
    #                 senti_count_auto = service_count_dict['senti_count_auto']
    #                 senti_auto_total_count = service_count_dict['senti_auto_total_count']
    #                 senti_count_news = service_count_dict['senti_count_news']
    #                 senti_news_total_count = service_count_dict['senti_news_total_count']
    #                 senti_count_finance = service_count_dict['senti_count_finance']
    #                 senti_finance_total_count = service_count_dict['senti_finance_total_count']
    #                 keywords_count = service_count_dict['keywords_count']
    #                 keywords_total_count = service_count_dict['keywords_total_count']
    #                 item_label_count = service_count_dict['item_label_count']
    #                 item_label_total_count = service_count_dict['item_label_total_count']
    #                 media_label_count = service_count_dict['media_label_count']
    #                 media_label_total_count = service_count_dict['media_label_total_count']
    #                 auto_summary_count = service_count_dict['auto_summary_count']
    #                 auto_summary_total_count = service_count_dict['auto_summary_total_count']
    #                 reputation_get_result_count = service_count_dict['reputation_get_result_count']
    #                 reputation_get_result_total_count = service_count_dict['reputation_get_result_total_count']
    #
    #                 senti_weibo_rest_count = int( senti_weibo_total_count ) - int( senti_count_weibo )
    #                 senti_auto_rest_count = int( senti_auto_total_count ) - int( senti_count_auto )
    #                 senti_news_rest_count = int( senti_news_total_count ) - int( senti_count_news )
    #                 senti_finance_rest_count = int( senti_finance_total_count ) - int( senti_count_finance )
    #                 keywords_rest_count = int( keywords_total_count ) - int( keywords_count )
    #                 item_label_rest_count = int( item_label_total_count ) - int( item_label_count )
    #                 media_label_rest_count = int( media_label_total_count ) - int( media_label_count )
    #                 auto_summary_rest_count = int( auto_summary_total_count ) - int( auto_summary_count )
    #                 reputation_get_result_rest_count = int( reputation_get_result_total_count ) - int( reputation_get_result_count )
    #                 return render( request, 'user.html', {"username":username, "email":email, "tel":tel, "token":token, "token_expiration":token_expiration, "senti_count_weibo":senti_count_weibo, "senti_count_auto":senti_count_auto, "senti_count_news":senti_count_news, "senti_count_finance":senti_count_finance, "keywords_count":keywords_count, "item_label_count":item_label_count, "media_label_count":media_label_count, "auto_summary_count":auto_summary_count, "reputation_get_result_count":reputation_get_result_count, "senti_weibo_total_count":senti_weibo_total_count, "senti_auto_total_count":senti_auto_total_count, "senti_news_total_count":senti_news_total_count, "senti_finance_total_count":senti_finance_total_count, "keywords_total_count":keywords_total_count, "item_label_total_count":item_label_total_count, "media_label_total_count":media_label_total_count, "auto_summary_total_count":auto_summary_total_count, "reputation_get_result_total_count":reputation_get_result_total_count, "senti_weibo_rest_count":senti_weibo_rest_count, "senti_auto_rest_count":senti_auto_rest_count, "senti_news_rest_count":senti_news_rest_count, "senti_finance_rest_count":senti_finance_rest_count, "keywords_rest_count":keywords_rest_count, "item_label_rest_count":item_label_rest_count, "media_label_rest_count":media_label_rest_count, "auto_summary_rest_count":auto_summary_rest_count, "reputation_get_result_rest_count":reputation_get_result_rest_count} )
    #     else:

    if username is None:
        return render(request, 'index.html')
    else:
        user_dict = show_userinfo(username)
        email = user_dict["email"]
        tel = user_dict["tel"]
        token = user_dict["token"]
        token_expiration = user_dict["token_expiration"]
        service_count_dict = serviceUsed(token)
        print 'service_count_dict:', service_count_dict
        if service_count_dict != {}:
            senti_count_weibo = service_count_dict['senti_count_weibo']
            senti_weibo_total_count = service_count_dict[
                'senti_weibo_total_count']
            senti_count_auto = service_count_dict['senti_count_auto']
            senti_auto_total_count = service_count_dict[
                'senti_auto_total_count']
            senti_count_news = service_count_dict['senti_count_news']
            senti_news_total_count = service_count_dict[
                'senti_news_total_count']
            senti_count_finance = service_count_dict['senti_count_finance']
            senti_finance_total_count = service_count_dict[
                'senti_finance_total_count']
            keywords_count = service_count_dict['keywords_count']
            keywords_total_count = service_count_dict['keywords_total_count']
            item_label_count = service_count_dict['item_label_count']
            item_label_total_count = service_count_dict[
                'item_label_total_count']
            media_label_count = service_count_dict['media_label_count']
            media_label_total_count = service_count_dict[
                'media_label_total_count']
            auto_summary_count = service_count_dict['auto_summary_count']
            auto_summary_total_count = service_count_dict[
                'auto_summary_total_count']
            reputation_get_result_count = service_count_dict[
                'reputation_get_result_count']
            reputation_get_result_total_count = service_count_dict[
                'reputation_get_result_total_count']

            senti_weibo_rest_count = int(senti_weibo_total_count) - int(
                senti_count_weibo)
            senti_auto_rest_count = int(senti_auto_total_count) - int(
                senti_count_auto)
            senti_news_rest_count = int(senti_news_total_count) - int(
                senti_count_news)
            senti_finance_rest_count = int(senti_finance_total_count) - int(
                senti_count_finance)
            keywords_rest_count = int(keywords_total_count) - int(
                keywords_count)
            item_label_rest_count = int(item_label_total_count) - int(
                item_label_count)
            media_label_rest_count = int(media_label_total_count) - int(
                media_label_count)
            auto_summary_rest_count = int(auto_summary_total_count) - int(
                auto_summary_count)
            reputation_get_result_rest_count = int(
                reputation_get_result_total_count) - int(
                    reputation_get_result_count)
            return render(
                request, 'user.html', {
                    "username":
                    username,
                    "email":
                    email,
                    "tel":
                    tel,
                    "token":
                    token,
                    "token_expiration":
                    token_expiration,
                    "senti_count_weibo":
                    senti_count_weibo,
                    "senti_count_auto":
                    senti_count_auto,
                    "senti_count_news":
                    senti_count_news,
                    "senti_count_finance":
                    senti_count_finance,
                    "keywords_count":
                    keywords_count,
                    "item_label_count":
                    item_label_count,
                    "media_label_count":
                    media_label_count,
                    "auto_summary_count":
                    auto_summary_count,
                    "reputation_get_result_count":
                    reputation_get_result_count,
                    "senti_weibo_total_count":
                    senti_weibo_total_count,
                    "senti_auto_total_count":
                    senti_auto_total_count,
                    "senti_news_total_count":
                    senti_news_total_count,
                    "senti_finance_total_count":
                    senti_finance_total_count,
                    "keywords_total_count":
                    keywords_total_count,
                    "item_label_total_count":
                    item_label_total_count,
                    "media_label_total_count":
                    media_label_total_count,
                    "auto_summary_total_count":
                    auto_summary_total_count,
                    "reputation_get_result_total_count":
                    reputation_get_result_total_count,
                    "senti_weibo_rest_count":
                    senti_weibo_rest_count,
                    "senti_auto_rest_count":
                    senti_auto_rest_count,
                    "senti_news_rest_count":
                    senti_news_rest_count,
                    "senti_finance_rest_count":
                    senti_finance_rest_count,
                    "keywords_rest_count":
                    keywords_rest_count,
                    "item_label_rest_count":
                    item_label_rest_count,
                    "media_label_rest_count":
                    media_label_rest_count,
                    "auto_summary_rest_count":
                    auto_summary_rest_count,
                    "reputation_get_result_rest_count":
                    reputation_get_result_rest_count
                })
Esempio n. 4
0
def get_userinfo(request, username):
    user_dict = show_userinfo(username)
    email = user_dict["email"]
    tel = user_dict["tel"]
    token = user_dict["token"]
    token_expiration = user_dict["token_expiration"]
    service_count_dict = serviceUsed(token)
    print 'service_count_dict:', service_count_dict
    if service_count_dict != {}:
        senti_count_weibo = service_count_dict['senti_count_weibo']
        senti_weibo_total_count = service_count_dict['senti_weibo_total_count']
        senti_count_auto = service_count_dict['senti_count_auto']
        senti_auto_total_count = service_count_dict['senti_auto_total_count']
        senti_count_news = service_count_dict['senti_count_news']
        senti_news_total_count = service_count_dict['senti_news_total_count']
        senti_count_finance = service_count_dict['senti_count_finance']
        senti_finance_total_count = service_count_dict[
            'senti_finance_total_count']

        keywords_count = service_count_dict['keywords_count']
        keywords_total_count = service_count_dict['keywords_total_count']
        item_label_count = service_count_dict['item_label_count']
        item_label_total_count = service_count_dict['item_label_total_count']
        media_label_count = service_count_dict['media_label_count']
        media_label_total_count = service_count_dict['media_label_total_count']
        auto_summary_count = service_count_dict['auto_summary_count']
        auto_summary_total_count = service_count_dict[
            'auto_summary_total_count']
        reputation_get_result_count = service_count_dict[
            'reputation_get_result_count']
        reputation_get_result_total_count = service_count_dict[
            'reputation_get_result_total_count']
        # print 'auto_summary_count',auto_summary_count
        return render(
            request, 'user.html', {
                "username":
                username,
                "email":
                email,
                "tel":
                tel,
                "token":
                token,
                "token_expiration":
                token_expiration,
                "senti_count_weibo":
                senti_count_weibo,
                "senti_count_auto":
                senti_count_auto,
                "senti_count_news":
                senti_count_news,
                "senti_count_finance":
                senti_count_finance,
                "keywords_count":
                keywords_count,
                "item_label_count":
                item_label_count,
                "media_label_count":
                media_label_count,
                "auto_summary_count":
                auto_summary_count,
                "reputation_get_result_count":
                reputation_get_result_count,
                "senti_weibo_total_count":
                senti_weibo_total_count,
                "senti_auto_total_count":
                senti_auto_total_count,
                "senti_news_total_count":
                senti_news_total_count,
                "senti_finance_total_count":
                senti_finance_total_count,
                "keywords_total_count":
                keywords_total_count,
                "item_label_total_count":
                item_label_total_count,
                "media_label_total_count":
                media_label_total_count,
                "auto_summary_total_count":
                auto_summary_total_count,
                "reputation_get_result_total_count":
                reputation_get_result_total_count
            })