Ejemplo n.º 1
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)
Ejemplo n.º 2
0
 def test_influences(self):
     #Valid Test 1 username
     api = Klout(self.KEY)
     data = api.identity('marcelcaraciolo', 'twitter')
     user_id = data['id']
     data = api.influences(user_id)
     self.assert_('myInfluencers' in data)
     self.assert_('myInfluencees' in data)
Ejemplo n.º 3
0
 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'])
Ejemplo n.º 4
0
 def test_createKloutAPI(self):
     api = Klout(self.KEY)
     self.assertEquals(api._api_key, self.KEY)
Ejemplo n.º 5
0
#!/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()
Ejemplo n.º 6
0
 def test_identity(self):
     api = Klout(self.KEY)
     data = api.identity('marcelcaraciolo', 'twitter')
     self.assert_('id' in data)
     self.assert_('network' in data)
Ejemplo n.º 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']
Ejemplo n.º 8
0
 def __init__(self, ):
     self.api = Klout('your APY KEY')
Ejemplo n.º 9
0
#!/usr/bin/python
# Twitter ID to weighted influencers
# Minor tweak
import sys
from MaltegoTransform import *
from pyklout import Klout

api = Klout("YOUR API KEY")
me = MaltegoTransform()
me.debug("Starting Transform")
#Debug Info

name = str(sys.argv[1])
data = api.identity(name, 'twitter')
user_id = data['id']
# fails hard if you feed it a name that doesn't have a Klout account
# really must find Python equivalent of Try::Tiny for this problem.
list = api.influences(user_id)

for inf in list['myInfluencers']:
    name = str(inf['entity']['payload']['nick'])
    score = str(int(inf['entity']['payload']['score']['score']))
    NewEnt = me.addEntity("AffiliationTwitter", name)
    NewEnt.setWeight(score)
    NewEnt.addAdditionalFields("affiliation.uid", "UID", "", name)
    nurl = "http://twitter.com/" + name
    NewEnt.addAdditionalFields("affiliation.profile-url", "Profile URL", "",
                               nurl)
    NewEnt.addAdditionalFields("twitter.screen-name", "Screen Name", "", name)

me.returnOutput()
Ejemplo n.º 10
0
#!C:\Python27
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']
Ejemplo n.º 11
0
#!/usr/bin/python
# Twitter ID to weighted influencers
# minor tweak
import sys
from MaltegoTransform import *
from pyklout import Klout

api = Klout("YOUR API KEY HERE")
me = MaltegoTransform();
me.debug("Starting Transform"); #Debug Info

name = str(sys.argv[1])
data = api.identity(name,'twitter')
user_id = data['id']
# fails hard if you feed it a name that doesn't have a Klout account
# really must find Python equivalent of Try::Tiny for this problem.
list = api.influences(user_id)

for inf in list['myInfluencees']:
    name = str(inf['entity']['payload']['nick']);
    score = str(int(inf['entity']['payload']['score']['score']));
    NewEnt = me.addEntity("AffiliationTwitter",name); 
    NewEnt.setWeight(score);
    NewEnt.addAdditionalFields("affiliation.uid","UID","",name);
    nurl = "http://twitter.com/" + name;
    NewEnt.addAdditionalFields("affiliation.profile-url","Profile URL","",nurl);
    NewEnt.addAdditionalFields("twitter.screen-name","Screen Name","",name);


me.returnOutput();