import urllib2
import json

listNames = open('list.txt', 'r')
ans = open('ans.txt', 'w')

a = ''
ls = []
for s in listNames :
	s = s[0:len(s) - 1]

	if(len(a) > 0) : 
		a += ';'
	a += s
	ls.append(s)

	if(len(ls) == 500) :
		data = json.load(urllib2.urlopen('http://c...content-available-to-author-only...s.com/api/user.info?handles=' + a))
		for i in range(len(ls)) :
			ans.write(ls[i])
			ans.write(' ' + str(data[u'result'][i][u'friendOfCount']) + '\n')
	
		ls = []
		a = ''

if(len(ls) > 0) :
	data = json.load(urllib2.urlopen('http://c...content-available-to-author-only...s.com/api/user.info?handles=' + a))
	for i in range(len(ls)) :
		ans.write(ls[i])
		ans.write(' ' + str(data[u'result'][i][u'friendOfCount']) + '\n')
