def test_topics(self): #Valid Test 1 username api = Klout(self.KEY) data = api.identity('marcelcaraciolo', 'twitter') user_id = data['id'] data = api.topics(user_id) for topic in data: for key in topic.keys(): self.assert_(key in ['imageUrl','slug','displayName', 'id', 'name'])
def test_topics(self): #Valid Test 1 username api = Klout(self.KEY) data = api.identity('marcelcaraciolo', 'twitter') user_id = data['id'] data = api.topics(user_id) for topic in data: for key in topic.keys(): self.assert_( key in ['imageUrl', 'slug', 'displayName', 'id', 'name'])
#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'] print '%s %f' % (nick, score) #User topics try: data = api.topics(user_id) except Exception, e: print 'Can\'t get topics of %s:\n%s' % (username,e) exit() print '\nTop topics\n' for x in data: topic = x['displayName'] print topic
#DESC: Transform Twitter entity into Klout topic URLs import sys import time from MaltegoTransform import * from pyklout import Klout # throttle to 8 calls/sec, should permit Maltego to chew through # long lists of Twitter accounts w/o overrunning API limit time.sleep(.125) # https://klout.com/s/developers/home # register an app, get an API key # wil look something like this api = Klout("xfv9wju86xn4wqsqzexample") name = str(sys.argv[1]) me = MaltegoTransform() data = api.identity(name, 'twitter') list = api.topics(data['id']) for topic in list: name = topic['displayName'] slug = topic['slug'] NewEnt = me.addEntity("maltego.URL", name) NewEnt.addAdditionalFields("url", "URL", "", "http://klout.com/topic/" + slug) me.returnOutput()
#!/usr/bin/python #DESC: Transform Twitter entity into Klout topic URLs import sys import time from MaltegoTransform import * from pyklout import Klout # throttle to 8 calls/sec, should permit Maltego to chew through # long lists of Twitter accounts w/o overrunning API limit time.sleep(.125) # https://klout.com/s/developers/home # register an app, get an API key # wil look something like this api = Klout("xfv9wju86xn4wqsqzexample") name = str(sys.argv[1]) me = MaltegoTransform(); data = api.identity(name,'twitter') list = api.topics(data['id']) for topic in list: name =topic['displayName'] slug =topic['slug'] NewEnt = me.addEntity("maltego.URL",name); NewEnt.addAdditionalFields("url","URL","","http://klout.com/topic/" + slug); me.returnOutput();
#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'] print '%s %f' % (nick, score) #User topics try: data = api.topics(user_id) except Exception, e: print 'Can\'t get topics of %s:\n%s' % (username, e) exit() print '\nTop topics\n' for x in data: topic = x['displayName'] print topic