pyklout

Python Wrapper for Klout (http://klout.com/) API


Keywords
klout, api
License
LGPL-3.0
Install
pip install pyklout==0.2

Documentation

PyKlout

PyKlout is an Python interface to Klout (http://klout.com) API.

Use of PyKlout requires a Klout API key. You can register and get a key at http://developer.klout.com/member/register

Now Supporting the API Release V2.

How to Install it

After download the source code by:

easy_install pyklout

or

https://github.com/marcelcaraciolo/PyKlout/tarball/master

Just execute the command at the terminal:

$ python setup.py install

How to Use it

>>> from pyklout import Klout
>>> api = Klout('YOUR API KEY GOES HERE')
>>>
>>> # Get the Klout Score 
>>> data = api.identity('marcelcaraciolo', 'twitter')
>>> #First you must fetch the klout user id.
>>> user_id = data['id']
>>> api.score(user_id)
{u'score': 51.613044738769531, u'scoreDelta': {u'dayChange': -0.25563812255859375, \
 u'monthChange': -0.54084014892578125, u'weekChange': -0.67768478393554688}}
>>>
>>> #Get the User influences
>>> data = api.influences(user_id)
>>> print data
{u'myInfluencersCount': 12, u'myInfluenceesCount': 688, u'myInfluencers': [{u'entity': {u'id': u'32088152110374909', \
 u'payload': {u'kloutId': u'32088152110374909', u'score': {u'score': 68.181953430175781}}}}, {u'entity': \
 {u'id': u'35747326807441155', u'payload': {u'kloutId': u'35747326807441155', u'scoreDeltas': \
 {u'dayChange': -0.2061004638671875, u'monthChange': 0.52481460571289062, u'weekChange': -0.73615646362304688}, \
u'score': {u'score': 61.678096771240234}}}}, {u'entity': {u'id': u'528598', u'payload': {u'kloutId': u'528598', \
 u'scoreDeltas': {u'dayChange': -0.30794143676757812, u'monthChange': -1.3581733703613281, \
u'weekChange': -0.95804977416992188}, u'score': {u'score': 57.507125854492188}}}}, \
{u'entity': {u'id': u'57420900014600367', u'payload': {u'kloutId': u'57420900014600367', u'scoreDeltas': \
 {u'dayChange': -0.10103988647460938, u'monthChange': -0.78160476684570312, u'weekChange': 0.048831939697265625}, \
 u'score': {u'score': 55.013530731201172}}}}, {u'entity': {u'id': u'84723972974129636', u'payload': \
{u'kloutId': u'84723972974129636', u'scoreDeltas': {u'dayChange': 0.34136962890625, u'monthChange': 14.804290771484375, \
 u'weekChange': -0.1102142333984375}, u'score': {u'score': 50.926513671875}}}}], u'myInfluencees': \
[{u'entity': {u'id': u'970250', u'payload': {u'kloutId': u'970250', u'scoreDeltas': {u'dayChange': -0.20825576782226562, \
u'monthChange': 0.56769561767578125, u'weekChange': -0.17999267578125}, u'score': {u'score': 46.707504272460938}}}}, \
 {u'entity': {u'id': u'27866027459763237', u'payload': {u'kloutId': u'27866027459763237', u'scoreDeltas': \
 {u'dayChange': -0.20732498168945312, u'monthChange': 1.8845806121826172, u'weekChange': -1.0561943054199219}, \
u'score': {u'score': 29.672574996948242}}}}, {u'entity': {u'id': u'291630', u'payload': {u'kloutId': u'291630', \
u'scoreDeltas': {u'dayChange': 3.017303466796875, u'monthChange': 2.9252605438232422, u'weekChange': 3.0163726806640625}, \
u'score': {u'score': 13.129240036010742}}}}]}

>>> # Get the Top topics for the username
>>> data = api.topics(user_id) 
>>> print data
[{u'imageUrl': u'http://kcdn3.klout.com/static/images/icons/generic-topic.png', u'slug': u'artificial-intelligence', \
 u'displayName': u'Artificial Intelligence', u'id': u'6715916572741025395', u'name': u'artificial intelligence'}, \
 {u'imageUrl': u'http://kcdn3.klout.com/static/images/books-1333558978086.png', u'slug': u'books', u'displayName': \
u'Books', u'id': u'5807244297982144638', u'name': u'books'}, {u'imageUrl': u'http://kcdn3.klout.com/static/images/topics/social-media.png', \
 u'slug': u'blogging', u'displayName': u'Blogging', u'id': u'7331299376965973530', u'name': u'blogging'}, {u'imageUrl': \ u'http://kcdn3.klout.com/static/images/icons/generic-topic.png', u'slug': u'python', u'displayName': u'Python', u'id': \
u'8389956153950126978', u'name': u'python'}, {u'imageUrl': u'http://kcdn3.klout.com/static/images/icons/generic-topic.png', \
 u'slug': u'idf', u'displayName': u'Idf', u'id': u'1242', u'name': u'idf'}]