Example #1
0
def get_friends_with_httpapi(user_name):
  global SESSION
  if SESSION is None:
    SESSION = Session(username = dic['username'], passwd = dic['passwd'])
    SESSION.connect()
  
  has_more = True
  cursor = -1
  friends_list = []
  count = 0

  while has_more and count < 100:
    has_more, cursor, friends = SESSION.get_friends(user_name, cursor)
    count += len(friends)
    friends_list.extend(friends)

  for f in friends_list:
    f['user_id'] = f['user_id'][1:]
    print "#", f

  return friends_list
import pickle
from twitter_rec import crawler
from twitter_rec.Api import Session
import conf
import simplejson as json
from bs4 import BeautifulSoup as BS

s = Session(conf.USERNAME, conf.PASSWD)
s.connect()

has_more = True
cursor = -1

while has_more:
  has_more, cursor, users = s.get_followers("russellpower", cursor)
  for u in users:
    print u['user_id']