Example #1
0
    def test_scores(self):
        #Valid Test 1 username
        api = Klout(self.KEY)
        data = api.score(['rafaelcaricio'])
        self.assertEquals(data[0][0], 'rafaelcaricio')
        self.assert_(data[0][1] < 100.0  and data[0][1] > 0.0)

        #Valid Test 5 usernames
        api = Klout(self.KEY)
        data = api.score(['rafaelcaricio', 'marcelcaraciolo', 'atepassar_', 'caocurseiro', 'google'])
        for (key, value) in data:
            self.assert_(key in ['rafaelcaricio', 'marcelcaraciolo', 'atepassar_', 'caocurseiro', 'google'])
            self.assert_(value <= 100.0  and value >= 0.0)

        #Valid Test Invalid Username in Twitter
        api = Klout(self.KEY)
        self.assertRaises(KloutError, api.score, ['ahahahahah'])

        #Valid Test No Data
        api = Klout(self.KEY)
        self.assertRaises(KloutError, api.score, [])

        #Valid Test More than 5
        api = Klout(self.KEY)
        usernames = ['rafaelcaricio', 'marcelcaraciolo', 'atepassar_', 'caocurseiro', 'google', 'timoreilly','googleapps']
        data = api.score(usernames)
        self.assertEquals(len(data),5)
        for (key, value) in data:
            self.assert_(key in ['rafaelcaricio', 'marcelcaraciolo', 'atepassar_', 'caocurseiro', 'google'])
            self.assert_(value <= 100.0  and value >= 0.0)
Example #2
0
 def test_scores(self):
     #Valid Test 1 username
     api = Klout(self.KEY)
     data = api.identity('marcelcaraciolo', 'twitter')
     user_id = data['id']
     data = api.score(user_id)
     self.assert_(data['score'] < 100.0 and data['score'] > 0.0)
Example #3
0
 def test_scores(self):
     #Valid Test 1 username
     api = Klout(self.KEY)
     data = api.identity('marcelcaraciolo', 'twitter')
     user_id = data['id']
     data = api.score(user_id)
     self.assert_(data['score'] < 100.0  and data['score'] > 0.0)
Example #4
0
class GetKlout(object):
    def __init__(self, ):
        self.api = Klout('your APY KEY')

    def get_klout(self, user_twitter):
        data = self.api.identity(str(user_twitter), 'tw')
        print data
        user_id = data['id']
        score = self.api.score(user_id)
        return score['score']
Example #5
0
from pyklout import Klout

api = Klout('acbxt9d2p52vmgvv2u38nrba')
username = raw_input('Twitter username: '******'twitter')
except Exception, e:
	print 'Can\'t find the user %s:\n%s' % (username,e)
	exit()
user_id = user['id']

#User score
try:
	score = api.score(user_id)
except Exception, e:
	print 'Can\'t get the score of %s:\n%s' % (username,e)
	exit()
print 'User score: %f' % (score['score'])

#User influences
try:
	data = api.influences(user_id)
except Exception, e:
	print 'Can\'t get influencers of %s:\n%s' % (username,e)
	exit()
print '\nInfluencers\n'
for x in data['myInfluencers']:
	nick = x['entity']['payload']['nick']
	score = x['entity']['payload']['score']['score']
Example #6
0
def get_klout_score(username):
    """ Get klout score based on twitter handle """
    api   = Klout(settings.API_KLOUT_KEY)
    data  = api.identity(str(username), 'twitter')
    score = api.score(data['id'])
    return score['score']
Example #7
0
def get_klout_score(username):
    """ Get klout score based on twitter handle """
    api = Klout(settings.API_KLOUT_KEY)
    data = api.identity(str(username), 'twitter')
    score = api.score(data['id'])
    return score['score']
Example #8
0
from pyklout import Klout

api = Klout('acbxt9d2p52vmgvv2u38nrba')
username = raw_input('Twitter username: '******'twitter')
except Exception, e:
    print 'Can\'t find the user %s:\n%s' % (username, e)
    exit()
user_id = user['id']

#User score
try:
    score = api.score(user_id)
except Exception, e:
    print 'Can\'t get the score of %s:\n%s' % (username, e)
    exit()
print 'User score: %f' % (score['score'])

#User influences
try:
    data = api.influences(user_id)
except Exception, e:
    print 'Can\'t get influencers of %s:\n%s' % (username, e)
    exit()
print '\nInfluencers\n'
for x in data['myInfluencers']:
    nick = x['entity']['payload']['nick']
    score = x['entity']['payload']['score']['score']