Example #1
0
    def GET(self):
        now_time = datetime.now()
        week_ago = now_time - timedelta(7)
        weibo_lists = SinaDao.getweibo()
        time = str(week_ago).split(' ')[0].split('-')
        new_weibo_lists = []
        for weibo_list in weibo_lists:
            weibo_time = weibo_list['create_time'].split(' ')

            #weibo_time[5] is year weibo_time[1] is month weibo_time[2] is day
            if int(weibo_time[5]) == int(time[0]) and StringUtil.converttime(
                    weibo_time[1]) == int(
                        time[1]) and int(weibo_time[2]) >= int(time[2]):
                new_weibo_lists.append(weibo_list)
            elif int(weibo_time[5]) > int(time[0]):
                new_weibo_lists.append(weibo_list)
            elif int(weibo_time[5]) == int(time[0]) and StringUtil.converttime(
                    weibo_time[1]) > int(time[1]):
                new_weibo_lists.append(weibo_list)
        result = []
        result.append([len(new_weibo_lists)])
        result.append(jiebafenci(new_weibo_lists))
        result.append(WeiboUtil.trends_weekly())
        result = str(result).replace("u'", "'")

        return result
Example #2
0
    def GET(self):
        now_time = datetime.now()
        week_ago = now_time - timedelta(7)
        weibo_lists = SinaDao.getweibo()
        time = str(week_ago).split(' ')[0].split('-')
        new_weibo_lists=[]
        for weibo_list in weibo_lists:
            weibo_time = weibo_list['create_time'].split(' ')

            #weibo_time[5] is year weibo_time[1] is month weibo_time[2] is day
            if  int(weibo_time[5])==int(time[0]) and StringUtil.converttime(weibo_time[1])==int(time[1]) and int(weibo_time[2])>=int(time[2]) :
                new_weibo_lists.append(weibo_list)
            elif int(weibo_time[5])>int(time[0]) :
                    new_weibo_lists.append(weibo_list)
            elif int(weibo_time[5])==int(time[0]) and StringUtil.converttime(weibo_time[1])>int(time[1]):
                new_weibo_lists.append(weibo_list)
        result=[]
        result.append([len(new_weibo_lists)])
        result.append(jiebafenci(new_weibo_lists))
        result.append(WeiboUtil.trends_weekly())
        result = str(result).replace("u'","'")
        
        return result
Example #3
0
    def GET(self):
        data = SinaDao.getmyinfo()
        if data['verified']:
            data['verified'] = u'是'
        else:
            data['verified'] = u'否'

        stime = data['created_at'].split(" ")
        

        data['created_at'] = str(stime[5])+u"年"+str(StringUtil.converttime(stime[1]))+u"月"+str(stime[2])+u"日"+StringUtil.convertweek(stime[0])+stime[3]
        print data
        result = {}
        for i in data:
            result[str(i)]=data[i]
        return str(result).replace('\'','\"')
Example #4
0
    def GET(self):
        data = SinaDao.getmyinfo()
        if data['verified']:
            data['verified'] = u'是'
        else:
            data['verified'] = u'否'

        stime = data['created_at'].split(" ")

        data['created_at'] = str(stime[5]) + u"年" + str(
            StringUtil.converttime(stime[1])) + u"月" + str(
                stime[2]) + u"日" + StringUtil.convertweek(stime[0]) + stime[3]
        print data
        result = {}
        for i in data:
            result[str(i)] = data[i]
        return str(result).replace('\'', '\"')