Esempio n. 1
0
def analyze(min, max):
    """ get the number of users whose friends count is between min(include) and max(exclude)"""

    friendsStore = FriendsStore()
    uids = friendsStore.uids()
    counts = friendsStore.counts(uids)
    size = 0
    for count in counts:
        if count >= min:
            if max < 0 or count < max:
                size = size + 1
    print '\ntotal:%d' % len(uids)
    print 'hits:%d' % size
Esempio n. 2
0
def analyze(min, max):
    """ get the number of users whose friends count is between min(include) and max(exclude)"""

    friendsStore = FriendsStore()
    uids = friendsStore.uids()
    counts = friendsStore.counts(uids)
    size = 0
    for count in counts:
        if count >= min:
            if max < 0 or count < max:
                size = size + 1
    print '\ntotal:%d' % len(uids)
    print 'hits:%d' % size
Esempio n. 3
0
#!/usr/bin/env python

from store import Queue, UserStore, FriendsStore, NameQueue
from weibo import WeiboClient, ApiException
from data import User
import time
import const
import string

queue = Queue()
userStore = UserStore()
friendsStore = FriendsStore()
nameQueue = NameQueue()
client = WeiboClient()

def main():
    initUid = const.initUid
    access_token = const.accessToken

    if queue.count()==0:
        queue.enqueue(initUid)

    while True:
        print '*******check name queue********'
        print 'step1: dequeue name'
        name = nameQueue.dequeue()
        if name is not None:
            print 'step2: get user by name : %s' % name
            try:
                user = client.getUserByName(name, access_token)
                if user is not None:
Esempio n. 4
0
#!/usr/bin/env python

from store import TeacherQueue, UserStore, FriendsStore, NameQueue, FlagSet, TeacherStore, TeacherSort
from weibo import WeiboClient, ApiException
from data import User
import time
import const
import string
import sys

queue = TeacherQueue()
userStore = UserStore()
teacherStore = TeacherStore()
teacherSort = TeacherSort()
friendsStore = FriendsStore()
nameQueue = NameQueue()
client = WeiboClient()
flagSet = FlagSet()


def main():
    initUid = const.initUid
    access_token = const.accessToken
    try:
        print 'INIT : search teacher'
        uids = client.searchTeacher(access_token)
        print 'INIT : teacher uids', uids
        print 'INIT : enqueue teacher uid'
        for uid in uids:
            queue.putFront(uid)
    except ApiException, e:
Esempio n. 5
0
#!/usr/bin/env python

from store import Queue, UserStore, FriendsStore, NameQueue
from weibo import WeiboClient, ApiException
from data import User
import time
import const
import string

queue = Queue()
userStore = UserStore()
friendsStore = FriendsStore()
nameQueue = NameQueue()
client = WeiboClient()


def main():
    initUid = const.initUid
    access_token = const.accessToken

    if queue.count() == 0:
        queue.enqueue(initUid)

    while True:
        print '*******check name queue********'
        print 'step1: dequeue name'
        name = nameQueue.dequeue()
        if name is not None:
            print 'step2: get user by name : %s' % name
            try:
                user = client.getUserByName(name, access_token)